return conn_install_mux(conn, mux_ops, ctx, prx, sess);
}
+/* Change the mux for the connection.
+ * The caller should make sure he's not subscribed to the underlying XPRT.
+ */
static inline int conn_upgrade_mux_fe(struct connection *conn, void *ctx, struct buffer *buf,
struct ist mux_proto, int mode)
{
old_mux_ctx = conn->ctx;
conn->mux = new_mux;
conn->ctx = ctx;
- conn_force_unsubscribe(conn);
if (new_mux->init(conn, bind_conf->frontend, conn->owner, buf) == -1) {
/* The mux upgrade failed, so restore the old mux */
conn->ctx = old_mux_ctx;
if (conn && h1c->flags & H1C_F_UPG_H2C) {
h1c->flags &= ~H1C_F_UPG_H2C;
+ /* Make sure we're no longer subscribed to anything */
+ if (h1c->wait_event.events)
+ conn->xprt->unsubscribe(conn, conn->xprt_ctx,
+ h1c->wait_event.events, &h1c->wait_event);
if (conn_upgrade_mux_fe(conn, NULL, &h1c->ibuf, ist("h2"), PROTO_MODE_HTX) != -1) {
/* connection successfully upgraded to H2, this
* mux was already released */
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;