From: Olivier Houchard Date: Thu, 17 Jan 2019 18:09:11 +0000 (+0100) Subject: BUG/MEDIUM: connections: Add the CO_FL_CONNECTED flag if a send succeeded. X-Git-Tag: v2.0-dev1~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f24502ba461d2dff1268aa73ce70a3400909d8d7;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: connections: Add the CO_FL_CONNECTED flag if a send succeeded. If a send succeeded, add the CO_FL_CONNECTED flag, the send may have been called by the upper layers before we even realized we were connected, and we may even read the response before we get the information, and si_cs_recv() has to know if we were connected or not. This should be backported to 1.9. --- diff --git a/src/raw_sock.c b/src/raw_sock.c index bdbcdede02..40b1bbc3dc 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -396,6 +396,8 @@ static size_t raw_sock_from_buf(struct connection *conn, const struct buffer *bu count -= ret; done += ret; + /* A send succeeded, so we can consier ourself connected */ + conn->flags |= CO_FL_CONNECTED; /* if the system buffer is full, don't insist */ if (ret < try) break; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 928de05f83..9153843be8 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -5723,6 +5723,8 @@ static size_t ssl_sock_from_buf(struct connection *conn, const struct buffer *bu goto out_error; } if (ret > 0) { + /* A send succeeded, so we can consier ourself connected */ + conn->flags |= CO_FL_CONNECTED; conn->xprt_st &= ~SSL_SOCK_SEND_UNLIMITED; count -= ret; done += ret;