diff options
author | Aki <please@ignore.pl> | 2020-08-24 17:12:18 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2020-08-24 17:12:18 +0200 |
commit | 1667f1be988e9a7f3ae745138b8bd5ecfdc165f5 (patch) | |
tree | a5d5d90a5b044eef13c3c5516fba2a20bebbfd3c | |
parent | e3d50af2ce41846fefda2a45ed153b05a02cf2f0 (diff) | |
download | plop-1667f1be988e9a7f3ae745138b8bd5ecfdc165f5.zip plop-1667f1be988e9a7f3ae745138b8bd5ecfdc165f5.tar.gz plop-1667f1be988e9a7f3ae745138b8bd5ecfdc165f5.tar.bz2 |
Extended error handling of accept in server
-rw-r--r-- | plop.c | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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. |