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).
This commit is contained in:
Willy Tarreau 2014-01-20 21:21:30 +01:00
parent fa7fc95e16
commit a593ec5bf4

View File

@ -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;
}
}