]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: backend: Defer conn_xprt_start() after mux creation
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 7 Nov 2025 10:24:14 +0000 (11:24 +0100)
committerOlivier Houchard <cognet@ci0.org>
Fri, 7 Nov 2025 10:40:52 +0000 (11:40 +0100)
In connect_server(), defer the call to conn_xprt_start() until after we
had a chance to create the mux. The xprt can behave differently
depending on if a mux is or is not available at this point, as if it is,
it may want to wait until some data comes from the mux.

This does not need to be backported.

src/backend.c

index 9937a7f9f0cab7dfb8bd6a1288f8461a1898bc13..c1f0ab2130f60fa01a38484555ad030fb97ceec5 100644 (file)
@@ -2175,7 +2175,6 @@ int connect_server(struct stream *s)
                        return SF_ERR_INTERNAL;
                }
        }
-       conn_xprt_start(srv_conn);
 
        /* We have to defer the mux initialization until after si_connect()
         * has been called, as we need the xprt to have been properly
@@ -2212,6 +2211,14 @@ int connect_server(struct stream *s)
                }
        }
 
+       /*
+        * Now that the mux may have been created, we can start the xprt.
+        * We had to wait until then, because the xprt may behave differently
+        * depending on if a mux already exists, and it can receive data
+        * from the stream, or not.
+        */
+       conn_xprt_start(srv_conn);
+
 #if defined(HAVE_SSL_0RTT)
        /* The flags change below deserve some explanation: when we want to
         * use early data, we first want to make sure that a mux is installed