MINOR: quic: liberate the TX stream buffer after ACK processing

The sending buffer of each stream is cleared when processing ACKs
corresponding to STREAM emitted frames. If the buffer is empty, free it
and offer it as with other dynamic buffers usage.

This should reduce memory consumption as before an opened stream
confiscate a buffer during its whole lifetime even if there is no more
data to transmit.
This commit is contained in:
Amaury Denoyelle 2022-02-24 10:56:33 +01:00
parent 642ab06313
commit 0c7679dd86

View File

@ -1405,6 +1405,11 @@ static int qcs_try_to_consume(struct qcs *qcs)
qcs->tx.ack_offset += diff;
b_del(strm->buf, diff);
ret = 1;
if (!b_data(strm->buf)) {
b_free(strm->buf);
offer_buffers(NULL, 1);
}
}
frm_node = eb64_next(frm_node);
@ -1435,6 +1440,11 @@ static inline void qc_treat_acked_tx_frm(struct quic_conn *qc,
qcs->tx.ack_offset += diff;
b_del(strm->buf, diff);
stream_acked = 1;
if (!b_data(strm->buf)) {
b_free(strm->buf);
offer_buffers(NULL, 1);
}
}
LIST_DELETE(&frm->list);