summaryrefslogtreecommitdiff
path: root/kike.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-08-10 17:28:10 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-08-10 19:19:53 +0200
commitccb27970828eeda5aa1f5aa6094a9acfaf093c35 (patch)
treeccb773d5572d7e326e8d861afdc4d4376423eafa /kike.c
parent753eacab420348265da7c5c1e00c477297d65aac (diff)
downloadxK-ccb27970828eeda5aa1f5aa6094a9acfaf093c35.tar.gz
xK-ccb27970828eeda5aa1f5aa6094a9acfaf093c35.tar.xz
xK-ccb27970828eeda5aa1f5aa6094a9acfaf093c35.zip
kike: proper shutdown on accept() failure
Diffstat (limited to 'kike.c')
-rw-r--r--kike.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kike.c b/kike.c
index 4511dae..edd0e6d 100644
--- a/kike.c
+++ b/kike.c
@@ -2645,9 +2645,11 @@ on_irc_client_available (const struct pollfd *pfd, void *user_data)
continue;
// TODO: handle resource exhaustion (EMFILE, ENFILE) specially
- // (stop accepting new connections and wait until we close some).
- // FIXME: handle this better, bring the server down cleanly.
- exit_fatal ("%s: %s", "accept", strerror (errno));
+ // (stop accepting new connections and wait until we close some;
+ // also set a timer in case of ENFILE).
+ print_fatal ("%s: %s", "accept", strerror (errno));
+ irc_initiate_quit (ctx);
+ break;
}
if (ctx->max_connections != 0 && ctx->n_clients >= ctx->max_connections)