From: Amaury Denoyelle Date: Thu, 24 Feb 2022 09:56:33 +0000 (+0100) Subject: MINOR: quic: liberate the TX stream buffer after ACK processing X-Git-Tag: v2.6-dev2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c7679dd86f53c04f52620dfa4f66980347683d0;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index a6eda370b5..3e63187b73 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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);