]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: release connection if no more bidir streams
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 24 Sep 2021 08:05:30 +0000 (10:05 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 7 Oct 2021 15:35:25 +0000 (17:35 +0200)
Use the count of bidirectional streams to call qc_release in qc_detach.
We cannot inspect the by_id tree because uni-streams are never removed
from it. This allows the connection to be properly freed.

src/mux_quic.c

index 19b021acbf8c323c36a1c8e83414b8a7b5e9569d..ba0a4a0a0a99b734378763db5ec25afff0fc559f 100644 (file)
@@ -911,6 +911,7 @@ static void qcs_destroy(struct qcs *qcs)
         * we're in it, we're getting out anyway
         */
        LIST_DEL_INIT(&qcs->list);
+       --qcs->qcc->strms[qcs_id_type(qcs->id)].nb_streams;
 
        /* ditto, calling tasklet_free() here should be ok */
        tasklet_free(qcs->shut_tl);
@@ -1600,7 +1601,7 @@ static void qc_detach(struct conn_stream *cs)
 
        TRACE_ENTER(QC_EV_STRM_END, qcs ? qcs->qcc->conn : NULL, qcs);
        qcs_destroy(qcs);
-       if (eb_is_empty(&qcc->streams_by_id))
+       if (!qcc->strms[QCS_CLT_BIDI].nb_streams)
                qc_release(qcc);
        TRACE_LEAVE(QC_EV_STRM_END, qcs ? qcs->qcc->conn : NULL);
 }