]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: implement standard method to detect if qcc is dead
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 8 Oct 2021 15:57:03 +0000 (17:57 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 13 Oct 2021 14:38:56 +0000 (16:38 +0200)
For the moment, a quic connection is considered dead if it has no
bidirectional streams left on it. This test is implemented via
qcc_is_dead function. It can be reused to properly close the connection
when needed.

src/mux_quic.c

index d16fd9777819cbfbb7bfc6cbcd801dfe1ec96261..578a59eebd55dc170022768f0947db49433c297d 100644 (file)
@@ -344,6 +344,7 @@ static inline int qcc_may_expire(const struct qcc *qcc)
 static __inline int
 qcc_is_dead(const struct qcc *qcc)
 {
+#if 0
        if (eb_is_empty(&qcc->streams_by_id) &&     /* don't close if streams exist */
            ((qcc->conn->flags & CO_FL_ERROR) ||    /* errors close immediately */
             (qcc->st0 >= QC_CS_ERROR && !qcc->task) || /* a timeout stroke earlier */
@@ -351,6 +352,9 @@ qcc_is_dead(const struct qcc *qcc)
             (!br_data(qcc->mbuf) &&  /* mux buffer empty, also process clean events below */
              conn_xprt_read0_pending(qcc->conn))))
                return 1;
+#endif
+       if (!qcc->strms[QCS_CLT_BIDI].nb_streams)
+               return 1;
 
        return 0;
 }
@@ -1561,7 +1565,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 (!qcc->strms[QCS_CLT_BIDI].nb_streams)
+       if (qcc_is_dead(qcc))
                qc_release(qcc);
        TRACE_LEAVE(QC_EV_STRM_END, qcs ? qcs->qcc->conn : NULL);
 }