Skip to content

Commit bb6296c

Browse files
committed
MINOR: mux-quic: do not count stream flow-control if already closed
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.
1 parent a473f19 commit bb6296c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/mux_quic.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
696696
qc_free_ncbuf(qcs, buf);
697697

698698
qcs->rx.offset += bytes;
699+
/* Not necessary to emit a MAX_STREAM_DATA if all data received. */
700+
if (qcs->flags & QC_SF_SIZE_KNOWN)
701+
goto conn_fctl;
702+
699703
if (qcs->rx.msd - qcs->rx.offset < qcs->rx.msd_init / 2) {
700704
TRACE_DATA("increase stream credit via MAX_STREAM_DATA", QMUX_EV_QCS_RECV, qcc->conn, qcs);
701705
frm = pool_zalloc(pool_head_quic_frame);
@@ -712,6 +716,7 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes)
712716
tasklet_wakeup(qcc->wait_event.tasklet);
713717
}
714718

719+
conn_fctl:
715720
qcc->lfctl.offsets_consume += bytes;
716721
if (qcc->lfctl.md - qcc->lfctl.offsets_consume < qcc->lfctl.md_init / 2) {
717722
TRACE_DATA("increase conn credit via MAX_DATA", QMUX_EV_QCS_RECV, qcc->conn, qcs);

0 commit comments

Comments
 (0)