From 667fefdc906bd4d4fc373be9125a8f397ae69b2b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 4 Mar 2020 17:22:10 +0100 Subject: [PATCH] BUG/MEDIUM: connection: stop polling for sending when the event is ready With commit 065a025610 ("MEDIUM: connection: don't stop receiving events in the FD handler") we disabled a number of fd_stop_* in conn_fd_handler(), in order to wait for their respective handlers to deal with them. But it is not correct to do that for the send direction, as we may very well have nothing to send. This is visible when connecting in TCP mode to a server with no data to send, there's nobody anymore to disable the polling for the send direction. And it is logical, on the recv() path we know the system has data to deliver and that some code will be in charge of it. On the send direction we simply don't know if it was the result of a successful connect() or if there is still something to send. In any case we almost never fill the network buffer on a single send() after being woken up by the system, so disabling the FD immediately or much later will not change the number of operations. No backport is needed, this is 2.2-dev. --- src/connection.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/connection.c b/src/connection.c index ee6818c3d..ae53d56df 100644 --- a/src/connection.c +++ b/src/connection.c @@ -106,6 +106,7 @@ void conn_fd_handler(int fd) conn->subs = NULL; } else io_available = 1; + fd_stop_send(fd); } /* The data transfer starts here and stops on error and handshakes. Note