summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@mailme.dk>2013-01-27 12:04:56 +0100
committerEmil Renner Berthing <esmil@mailme.dk>2013-01-27 17:32:14 +0100
commitf27e9657213a42fb500eb32f089d0df68e75f71c (patch)
tree94b498537c52268954063184b1cd9085a4562fd7
parent868f573430113b9fcf751370acaa486d064a08d3 (diff)
downloadlem-f27e9657213a42fb500eb32f089d0df68e75f71c.tar.gz
lem-f27e9657213a42fb500eb32f089d0df68e75f71c.tar.xz
lem-f27e9657213a42fb500eb32f089d0df68e75f71c.zip
io: ignore protocol errors on accept
-rw-r--r--lem/io/server.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/lem/io/server.c b/lem/io/server.c
index 7ed0319..2240254 100644
--- a/lem/io/server.c
+++ b/lem/io/server.c
@@ -99,9 +99,16 @@ server__accept(lua_State *T, struct ev_io *w, int mt)
int sock = accept(w->fd, NULL, NULL);
if (sock < 0) {
- if (errno == EAGAIN || errno == EINTR || errno == ECONNABORTED)
+ switch (errno) {
+ case EAGAIN: case EINTR: case ECONNABORTED:
+ case ENETDOWN: case EPROTO: case ENOPROTOOPT:
+ case EHOSTDOWN:
+#ifdef ENONET
+ case ENONET:
+#endif
+ case EHOSTUNREACH: case EOPNOTSUPP: case ENETUNREACH:
return 0;
-
+ }
lua_pushnil(T);
lua_pushfstring(T, "error accepting connection: %s",
strerror(errno));
@@ -182,8 +189,16 @@ server_autospawn_cb(EV_P_ struct ev_io *w, int revents)
/* dequeue the incoming connection */
sock = accept(w->fd, NULL, NULL);
if (sock < 0) {
- if (errno == EAGAIN || errno == EINTR || errno == ECONNABORTED)
+ switch (errno) {
+ case EAGAIN: case EINTR: case ECONNABORTED:
+ case ENETDOWN: case EPROTO: case ENOPROTOOPT:
+ case EHOSTDOWN:
+#ifdef ENONET
+ case ENONET:
+#endif
+ case EHOSTUNREACH: case EOPNOTSUPP: case ENETUNREACH:
return;
+ }
lua_pushnil(T);
lua_pushfstring(T, "error accepting connection: %s",
strerror(errno));