]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: muxes: Don't handle proto upgrade for muxes not supporting it
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 14 Apr 2022 09:23:50 +0000 (11:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 14 Apr 2022 09:57:06 +0000 (11:57 +0200)
Several muxes (h2, fcgi, quic) don't support the protocol upgrade. For these
muxes, there is no reason to have code to support it. Thus in the destroy
callback, there is now a BUG_ON() and the release function is simplified
because the connection is always owned by the mux..

src/mux_fcgi.c
src/mux_h2.c
src/mux_quic.c

index cdb118c3a17b100fe379124656485d83ab459e51..cfe39dd83330d69cc59bdd63312e6020fbcdec9e 100644 (file)
@@ -845,9 +845,7 @@ static void fcgi_release(struct fcgi_conn *fconn)
        TRACE_POINT(FCGI_EV_FCONN_END);
 
        if (fconn) {
-               /* The connection must be attached to this mux to be released */
-               if (fconn->conn && fconn->conn->ctx == fconn)
-                       conn = fconn->conn;
+               conn = fconn->conn;
 
                TRACE_DEVEL("freeing fconn", FCGI_EV_FCONN_END, conn);
 
@@ -3576,8 +3574,10 @@ static void fcgi_destroy(void *ctx)
        struct fcgi_conn *fconn = ctx;
 
        TRACE_POINT(FCGI_EV_FCONN_END, fconn->conn);
-       if (eb_is_empty(&fconn->streams_by_id) || fconn->conn->ctx != fconn)
+       if (eb_is_empty(&fconn->streams_by_id)) {
+               BUG_ON(fconn->conn->ctx != fconn);
                fcgi_release(fconn);
+       }
 }
 
 /*
index d73e0cf440fad5be3a98198d67841296d398741b..000f231246b0e11f29420139a20e998a6cd81440 100644 (file)
@@ -1166,9 +1166,7 @@ static void h2_release(struct h2c *h2c)
        TRACE_ENTER(H2_EV_H2C_END);
 
        if (h2c) {
-               /* The connection must be aattached to this mux to be released */
-               if (h2c->conn && h2c->conn->ctx == h2c)
-                       conn = h2c->conn;
+               conn = h2c->conn;
 
                TRACE_DEVEL("freeing h2c", H2_EV_H2C_END, conn);
                hpack_dht_free(h2c->ddht);
@@ -4350,8 +4348,10 @@ static void h2_destroy(void *ctx)
        struct h2c *h2c = ctx;
 
        TRACE_ENTER(H2_EV_H2C_END, h2c->conn);
-       if (eb_is_empty(&h2c->streams_by_id) || h2c->conn->ctx != h2c)
+       if (eb_is_empty(&h2c->streams_by_id)) {
+               BUG_ON(h2c->conn->ctx != h2c);
                h2_release(h2c);
+       }
        TRACE_LEAVE(H2_EV_H2C_END);
 }
 
index 2051bff105e79a7fd524bbf8cd45bb159d0b9aed..aea64910069d59df501376c5c043b83d8cdd07eb 100644 (file)
@@ -502,9 +502,7 @@ static void qc_release(struct qcc *qcc)
        if (qcc) {
                struct eb64_node *node;
 
-               /* The connection must be aattached to this mux to be released */
-               if (qcc->conn && qcc->conn->ctx == qcc)
-                       conn = qcc->conn;
+               conn = qcc->conn;
 
                TRACE_DEVEL("freeing qcc", QMUX_EV_QCC_END, conn);