From 5c4373a47b1b84f6d32a0904c00cde3e5d96393a Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 24 May 2022 14:47:48 +0200 Subject: [PATCH] MINOR: mux-quic: disable read on CONNECTION_CLOSE emission Similar to sending, read operations are disabled when a CONNECTION_CLOSE frame has been emitted. Most notably, this prevents unneeded loop demuxing when the H3 layer has issue an error and cannot process the buffer payload anymore. Note that read is not prevented for unidirectional streams for the moment. This will supported soon with the unification of bidir and uni streams treatment. --- src/mux_quic.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mux_quic.c b/src/mux_quic.c index 91dffdf05..f6d352cdf 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -102,7 +102,7 @@ struct trace_source trace_qmux = { INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE); /* Emit a CONNECTION_CLOSE with error . This will interrupt all future - * send operations. + * send/receive operations. */ static void qcc_emit_cc(struct qcc *qcc, int err) { @@ -469,6 +469,11 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset, TRACE_ENTER(QMUX_EV_QCC_RECV, qcc->conn); + if (qcc->flags & QC_CF_CC_EMIT) { + TRACE_DEVEL("leaving on error", QMUX_EV_QCC_RECV, qcc->conn); + return 0; + } + qcs = qcc_get_qcs(qcc, id); if (!qcs) { if ((id >> QCS_ID_TYPE_SHIFT) <= qcc->strms[qcs_id_type(id)].largest_id) { @@ -1138,6 +1143,11 @@ static int qc_recv(struct qcc *qcc) TRACE_ENTER(QMUX_EV_QCC_RECV); + if (qcc->flags & QC_CF_CC_EMIT) { + TRACE_DEVEL("leaving on error", QMUX_EV_QCC_RECV, qcc->conn); + return 0; + } + node = eb64_first(&qcc->streams_by_id); while (node) { qcs = eb64_entry(node, struct qcs, by_id);