From: Willy Tarreau Date: Tue, 10 Dec 2019 07:42:21 +0000 (+0100) Subject: BUG/MINOR: listener: also clear the error flag on a paused listener X-Git-Tag: v2.2-dev1~202 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20aeb1c7cd38907d704a4d769695b9ea264fa4c0;p=thirdparty%2Fhaproxy.git BUG/MINOR: listener: also clear the error flag on a paused listener When accept() fails because a listener is temporarily paused, the FD might have both FD_POLL_HUP and FD_POLL_ERR bits set. While we do not exploit FD_POLL_ERR here it's better to clear it because it is reported on "show fd" and is confusing. This may be backported to all versions. --- diff --git a/src/listener.c b/src/listener.c index fdb91ea38e..ed8b60fa7d 100644 --- a/src/listener.c +++ b/src/listener.c @@ -793,13 +793,13 @@ void listener_accept(int fd) if (unlikely(cfd == -1)) { switch (errno) { case EAGAIN: - if (fdtab[fd].ev & FD_POLL_HUP) { + if (fdtab[fd].ev & (FD_POLL_HUP|FD_POLL_ERR)) { /* the listening socket might have been disabled in a shared * process and we're a collateral victim. We'll just pause for * a while in case it comes back. In the mean time, we need to * clear this sticky flag. */ - _HA_ATOMIC_AND(&fdtab[fd].ev, ~FD_POLL_HUP); + _HA_ATOMIC_AND(&fdtab[fd].ev, ~(FD_POLL_HUP|FD_POLL_ERR)); goto transient_error; } fd_cant_recv(fd);