From 152beeec34baed98ad4c186454ddb25e4c496b50 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 24 May 2023 14:43:43 +0200 Subject: [PATCH] MINOR: mux-quic: report error on stream-endpoint earlier A RESET_STREAM is emitted in several occasions : - protocol error during HTTP/3.0 parsing - STOP_SENDING reception In both cases, if a stream-endpoint is attached we must set its ERR flag. This was correctly done but after some delay as it was only when the RESET_STREAM was emitted. Change this to set the ERR flag as soon as one of the upper cases has been encountered. This should help to release faster streams in error. This should be backported up to 2.7. --- src/mux_quic.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mux_quic.c b/src/mux_quic.c index 99cb37f06..7c74bc4ad 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -883,6 +883,13 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs) TRACE_ERROR("decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs); goto err; } + + if (qcs->flags & QC_SF_TO_RESET) { + if (qcs_sc(qcs) && !se_fl_test(qcs->sd, SE_FL_ERROR|SE_FL_ERR_PENDING)) { + se_fl_set_error(qcs->sd); + qcs_alert(qcs); + } + } } else { TRACE_DATA("ignore read on stream", QMUX_EV_QCS_RECV, qcc->conn, qcs); @@ -1398,6 +1405,12 @@ int qcc_recv_stop_sending(struct qcc *qcc, uint64_t id, uint64_t err) */ qcc_reset_stream(qcs, err); + /* Report send error to stream-endpoint layer. */ + if (qcs_sc(qcs)) { + se_fl_set_error(qcs->sd); + qcs_alert(qcs); + } + if (qcc_may_expire(qcc) && !qcc->nb_hreq) qcc_refresh_timeout(qcc); @@ -1816,11 +1829,6 @@ static int qcs_send_reset(struct qcs *qcs) return 1; } - if (qcs_sc(qcs)) { - se_fl_set_error(qcs->sd); - qcs_alert(qcs); - } - qcs_close_local(qcs); qcs->flags &= ~QC_SF_TO_RESET;