]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-spop: Wait end of handshake to declare a spop connection ready
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Apr 2025 06:01:40 +0000 (08:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Apr 2025 12:44:42 +0000 (14:44 +0200)
A SPOP connection must not be considered as ready while the hello handshake
is not finished with success. In addition, no error or shutdown must have
been reported for the underlying connection. Otherwise a freshly openned
spop connexion may be reused while it is in fact dead, leading to a
connection retry.

This patch must be backported to 3.1.

src/mux_spop.c

index 6bd520362132370b723a4334a11c8d5172106816..1dc4b3588f07f42910ab6a873e478db75b3b31e8 100644 (file)
@@ -2666,7 +2666,8 @@ static int spop_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *ou
 
        switch (mux_ctl) {
        case MUX_CTL_STATUS:
-               if (!(conn->flags & CO_FL_WAIT_XPRT))
+               if ((spop_conn->state >= SPOP_CS_FRAME_H && spop_conn->state < SPOP_CS_ERROR) &&
+                   !(spop_conn->flags & (SPOP_CF_ERROR|SPOP_CF_ERR_PENDING|SPOP_CF_END_REACHED||SPOP_CF_RCVD_SHUT|SPOP_CF_DISCO_SENT|SPOP_CF_DISCO_FAILED)))
                        ret |= MUX_STATUS_READY;
                return ret;
        case MUX_CTL_EXIT_STATUS: