From a593ec5bf4ac58e7489535eb256f4763ac8027ff Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 20 Jan 2014 21:21:30 +0100 Subject: [PATCH] MEDIUM: listener: fix polling management in the accept loop The accept loop used to force fd_poll_recv() even in places where it was not completely appropriate (eg: unexpected errors). It does not yet cause trouble but will do with the upcoming polling changes. Let's use it only where relevant now. EINTR/ECONNABORTED do not result in poll() anymore but the failed connection is simply skipped (this code dates from 1.1.32 when error codes were first considered). --- src/listener.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/listener.c b/src/listener.c index e5e723f..c941817 100644 --- a/src/listener.c +++ b/src/listener.c @@ -324,10 +324,11 @@ void listener_accept(int fd) if (unlikely(cfd == -1)) { switch (errno) { case EAGAIN: - case EINTR: - case ECONNABORTED: fd_poll_recv(fd); return; /* nothing more to accept */ + case EINTR: + case ECONNABORTED: + continue; case ENFILE: if (p) send_log(p, LOG_EMERG, @@ -354,8 +355,7 @@ void listener_accept(int fd) task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */ return; default: - /* unexpected result, let's go back to poll */ - fd_poll_recv(fd); + /* unexpected result, let's give up and let other tasks run */ return; } } -- 1.7.10.4