From: Olivier Houchard Date: Wed, 15 Jan 2020 18:16:23 +0000 (+0100) Subject: BUG/MEDIUM: raw_sock: Make sur the fd and conn are sync. X-Git-Tag: v2.2-dev1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac8147446c7a3d1aa607042bc782095b03bc8dc4;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: raw_sock: Make sur the fd and conn are sync. Commit 08fa16e397ffb1c6511b98ade2a3bfff9435e521 made sure we let the fd layer we didn't want to poll anymore if we failed to send and sendto() returne EAGAIN. However, just disabling the polling with fd_stop_send() while not notifying the connection layer means the connection layer may believe the polling is activated and nothing needs to be done when it is wrong. A better fix is to revamp that whole code, for the time being, just make sure the fd and connection layer are properly synchronised. This should fix the problem recently reported on FreeBSD. --- diff --git a/src/raw_sock.c b/src/raw_sock.c index ed90a02dc7..197d27d147 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -378,8 +378,10 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s /* if the system buffer is full, don't insist */ if (ret < try) break; - if (!count) - fd_stop_send(conn->handle.fd); + if (!count) { + conn_xprt_stop_send(conn); + conn_refresh_polling_flags(conn); + } } else if (ret == 0 || errno == EAGAIN || errno == ENOTCONN || errno == EINPROGRESS) { /* nothing written, we need to poll for write first */