From f24502ba461d2dff1268aa73ce70a3400909d8d7 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 17 Jan 2019 19:09:11 +0100 Subject: [PATCH] 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. --- src/raw_sock.c | 2 ++ src/ssl_sock.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/raw_sock.c b/src/raw_sock.c index bdbcdede0..40b1bbc3d 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 928de05f8..9153843be 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;