]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream_interface: Only use SI_ST_RDY when the mux is ready.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 25 Oct 2019 14:25:20 +0000 (16:25 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 29 Oct 2019 13:15:20 +0000 (14:15 +0100)
In si_connect(), only switch the strema_interface status to SI_ST_RDY if
we're reusing a connection and if the connection's mux is ready. Otherwise,
maybe we're reusing a connection that is not fully established yet, and may
fail, and setting SI_ST_RDY would mean we would not be able to retry to
connect.

This should be backported to 1.9 and 2.0.
This commit depends on 55234e33708c5a584fb9efea81d71ac47235d518.

include/proto/stream_interface.h

index e0f699184c4874f316f620f583bdf9f5d0a52c40..c0f88b265c59b74fe651549d80c72946f9ab84c3 100644 (file)
@@ -521,7 +521,11 @@ static inline int si_connect(struct stream_interface *si, struct connection *con
                /* try to reuse the existing connection, it will be
                 * confirmed once we can send on it.
                 */
-               si->state = SI_ST_RDY;
+               /* Is the connection really ready ? */
+               if (conn->mux->ctl(conn, MUX_STATUS, NULL) & MUX_STATUS_READY)
+                       si->state = SI_ST_RDY;
+               else
+                       si->state = SI_ST_CON;
        }
 
        /* needs src ip/port for logging */