]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connections: Add the CO_FL_CONNECTED flag if a send succeeded.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 17 Jan 2019 18:09:11 +0000 (19:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 Jan 2019 18:18:20 +0000 (19:18 +0100)
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.

src/raw_sock.c
src/ssl_sock.c

index bdbcdede0242b1c6af72e50cc27f9fad374b6a5c..40b1bbc3dce8a0d023e6ef1a684a89ca27af0018 100644 (file)
@@ -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;
index 928de05f832c949d4a52d4ae09fe5ad235fb3f1b..9153843be82d6ee268036251d5ce246e91874279 100644 (file)
@@ -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;