]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: disable read on CONNECTION_CLOSE emission
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 24 May 2022 12:47:48 +0000 (14:47 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 25 May 2022 13:41:25 +0000 (15:41 +0200)
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

index 91dffdf05b4ced6ca296e6fddd178c62b2520832..f6d352cdfc9a1505fe36705d7304d7fc583b20e9 100644 (file)
@@ -102,7 +102,7 @@ struct trace_source trace_qmux = {
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
 /* Emit a CONNECTION_CLOSE with error <err>. 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);