diff options
Diffstat (limited to 'ldadp.c')
-rw-r--r-- | ldadp.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -116,11 +116,18 @@ static void listen_callback(void *data, int haveIn, int haveOut, int doCleanup) epoll_listen_t *listen = (epoll_listen_t *)data; char remote[4]; uint16 port; + static unsigned int accept_fails = 0; int sock = socket_accept4(listen->fd, remote, &port); - if (sock < 0) { - printf("[Proxy] Error accepting new connection.\n"); + if (sock == -1) { + printf("[Proxy] Error accepting new connection (%d)\n", errno); + if (_autoRestart && ++accept_fails > 10) { + bail("Too many accept failures"); + } return; } + if (accept_fails > 0) { + accept_fails--; + } helper_nonblock(sock); SSL *ssl = NULL; if (listen->sslContext != NULL) { |