BUG/MEDIUM: connections: Make sure we're unsubscribe before upgrading the mux.
Just calling conn_force_unsubscribe() from conn_upgrade_mux_fe() is not
enough, as there may be multiple XPRT involved. Instead, require that
any user of conn_upgrade_mux_fe() unsubscribe itself before calling it.
This should fix upgrading a TCP connection to HTX when using SSL.
This should be backported to 2.0.
(cherry picked from commit 2ab3dada015e071f505554cf443bfc438ce863e5)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/proxy.c b/src/proxy.c
index 78babd5..f669ebf 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1470,6 +1470,13 @@
if (conn && cs) {
si_rx_endp_more(&s->si[0]);
+ /* Make sure we're unsubscribed, the the new
+ * mux will probably want to subscribe to
+ * the underlying XPRT
+ */
+ if (s->si[0].wait_event.events)
+ conn->mux->unsubscribe(cs, s->si[0].wait_event.events,
+ &s->si[0].wait_event);
if (conn_upgrade_mux_fe(conn, cs, &s->req.buf, ist(""), PROTO_MODE_HTX) == -1)
return 0;
s->flags |= SF_HTX;