From: Amaury Denoyelle Date: Mon, 19 Oct 2026 11:55:19 +0000 (+0200) Subject: MINOR: h3: remove dead code on h3_rcv_buf() error path X-Git-Tag: v3.5-dev10~112 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=8eb164e14;p=haproxy.git MINOR: h3: remove dead code on h3_rcv_buf() error path Previous patches rework error handling and glitch reporting in h3_rcv_buf() after a connection level error occured. A similar pattern is adopted after each frame parsers : when a connection level error is encountered, glitch is incremented and parsing is immediately interrupted using early return via err label. To ensure the code remains safe though with future evolution, h3c check on h3_rcv_buf() epilogue is replaced so that qcc_set_error() is only set if not already done, which is currently unnecessary. A WARN_ON() should help to detect such cases. --- diff --git a/src/h3.c b/src/h3.c index be9cd7470..b4946fbc6 100644 --- a/src/h3.c +++ b/src/h3.c @@ -2274,6 +2274,14 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin) } } + if (unlikely(h3c->err)) { + /* Should be dead code : err conn must be handled directly after frame parsing and redirected to err label. */ + WARN_ON(1, "h3c error not correctly handled"); + if (!(qcs->qcc->flags & (QC_CF_ERR_CONN|QC_CF_ERRL))) + qcc_set_error(qcs->qcc, h3c->err, 1, muxc_tevt_type_proto_err); + goto err; + } + /* Reset demux frame type for traces. */ if (!h3s->demux_frame_len) h3s->demux_frame_type = H3_FT_UNINIT; @@ -2288,11 +2296,6 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin) total += b_data(b); goto done; } - else if (h3c->err) { - qcc_set_error(qcs->qcc, h3c->err, 1, muxc_tevt_type_proto_err); - total += b_data(b); - goto done; - } else if (unlikely(ret < 0)) { qcc_set_error(qcs->qcc, H3_ERR_INTERNAL_ERROR, 1, muxc_tevt_type_internal_err); goto err;