]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: do not count stream flow-control if already closed
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 9 Dec 2022 14:00:17 +0000 (15:00 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Dec 2022 15:29:59 +0000 (16:29 +0100)
It is unnecessary to increase stream credit once its size is known.
Indeed, a peer cannot sent a greater offset than the value advertized.
Else, connection will be closed on STREAM reception with
FINAL_SIZE_ERROR.

This commit is a small optimization and may prevent the emission of
unneeded MAX_STREAM_DATA frames on some occasions.

It should be backported up to 2.7.

src/mux_quic.c

index a5e443f7d3e7485b024f513b9663e4362b9bf51c..e4721fd39d4ad30eb5c60e5da28e3d5e20c0154b 100644 (file)
@@ -696,6 +696,10 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
                qc_free_ncbuf(qcs, buf);
 
        qcs->rx.offset += bytes;
+       /* Not necessary to emit a MAX_STREAM_DATA if all data received. */
+       if (qcs->flags & QC_SF_SIZE_KNOWN)
+               goto conn_fctl;
+
        if (qcs->rx.msd - qcs->rx.offset < qcs->rx.msd_init / 2) {
                TRACE_DATA("increase stream credit via MAX_STREAM_DATA", QMUX_EV_QCS_RECV, qcc->conn, qcs);
                frm = pool_zalloc(pool_head_quic_frame);
@@ -712,6 +716,7 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
                tasklet_wakeup(qcc->wait_event.tasklet);
        }
 
+ conn_fctl:
        qcc->lfctl.offsets_consume += bytes;
        if (qcc->lfctl.md - qcc->lfctl.offsets_consume < qcc->lfctl.md_init / 2) {
                TRACE_DATA("increase conn credit via MAX_DATA", QMUX_EV_QCS_RECV, qcc->conn, qcs);