From: Amaury Denoyelle Date: Fri, 8 Oct 2021 15:57:03 +0000 (+0200) Subject: MINOR: mux-quic: implement standard method to detect if qcc is dead X-Git-Tag: v2.5-dev10~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac8ee256598487f695fc0b18c991001059e8bb19;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: implement standard method to detect if qcc is dead 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. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index d16fd97778..578a59eebd 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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); }