mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-25 07:41:36 +02:00
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:
parent
fa7fc95e16
commit
a593ec5bf4
@ -324,10 +324,11 @@ void listener_accept(int fd)
|
|||||||
if (unlikely(cfd == -1)) {
|
if (unlikely(cfd == -1)) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
case EINTR:
|
|
||||||
case ECONNABORTED:
|
|
||||||
fd_poll_recv(fd);
|
fd_poll_recv(fd);
|
||||||
return; /* nothing more to accept */
|
return; /* nothing more to accept */
|
||||||
|
case EINTR:
|
||||||
|
case ECONNABORTED:
|
||||||
|
continue;
|
||||||
case ENFILE:
|
case ENFILE:
|
||||||
if (p)
|
if (p)
|
||||||
send_log(p, LOG_EMERG,
|
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 */
|
task_schedule(global_listener_queue_task, tick_add(now_ms, 100)); /* try again in 100 ms */
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
/* unexpected result, let's go back to poll */
|
/* unexpected result, let's give up and let other tasks run */
|
||||||
fd_poll_recv(fd);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user