summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--plop.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/plop.c b/plop.c
index 8fd8cd1..ec7eb3d 100644
--- a/plop.c
+++ b/plop.c
@@ -166,7 +166,33 @@ int handle_server(lua_State * L, const int efd, const int server)
const int client = accept(server, NULL, NULL);
if (-1 == client)
{
- return -1; // TODO: Consider not crashing entire server because of one accept.
+ switch (errno)
+ {
+ case EAGAIN:
+#if EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
+ case ENETDOWN:
+ case EPROTO:
+ case ENOPROTOOPT:
+ case EHOSTDOWN:
+ case ENONET:
+ case EHOSTUNREACH:
+ case EOPNOTSUPP:
+ case ENETUNREACH:
+ case ECONNABORTED:
+ case EMFILE:
+ case ENFILE:
+ case ENOBUFS:
+ case ENOMEM:
+ {
+ return 0;
+ }
+ default:
+ {
+ return -1;
+ }
+ }
}
// TODO: Request is not the enitre state of the client. Make them distinct along with responses.