]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: listener: fix polling management in the accept loop
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Jan 2014 20:21:30 +0000 (21:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Jan 2014 21:27:16 +0000 (22:27 +0100)
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

index e5e723f4571509e4fd6b1aae9552843e4b86a80c..c9418178ff5fba4c4a2548dc7db3d698d846df26 100644 (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;
                        }
                }