From: Amaury Denoyelle Date: Tue, 4 Mar 2025 08:41:44 +0000 (+0100) Subject: MINOR: mux-quic: refine reception of standalone STREAM FIN X-Git-Tag: v3.2-dev7~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dd1eec2b10bd13f05c792ec0e053c19aac952ee;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: refine reception of standalone STREAM FIN Reception of standalone STREAM FIN is a corner case, which may be difficult to handle. In particular, care must be taken to ensure app_ops rcv_buf() is always called to be notify about FIN, even if Rx buffer is empty or full demux flag is set. If this is the case, it could prevent closure of QCS Rx channel. To ensure this, rcv_buf() was systematically called if FIN was received, with or without data payload. This could called unnecessary invokation when FIN is transmitted with data and full demux flag is set, or data are received out-of-order. This patches improve qcc_recv() by detecting explicitely a standalone FIN case. Thus, rcv_buf() is only forcefully called in this case and if all data were already previously received. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index c343f8c9e..ba6b446e5 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1499,6 +1499,7 @@ int qcc_install_app_ops(struct qcc *qcc, const struct qcc_app_ops *app_ops) int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset, char fin, char *data) { + const int fin_standalone = (!len && fin); struct qcs *qcs; enum ncb_ret ret; @@ -1627,7 +1628,8 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset, qcs_close_remote(qcs); } - if ((ncb_data(&qcs->rx.ncbuf, 0) && !(qcs->flags & QC_SF_DEM_FULL)) || fin) { + if ((ncb_data(&qcs->rx.ncbuf, 0) && !(qcs->flags & QC_SF_DEM_FULL)) || + unlikely(fin_standalone && qcs_is_close_remote(qcs))) { qcc_decode_qcs(qcc, qcs); LIST_DEL_INIT(&qcs->el_recv); qcc_refresh_timeout(qcc);