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.
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);
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);