MINOR: mux-quic: free RX buf if empty
Release the QCS RX buffer if emptied afer qcs_consume(). This improves memory usage and avoids a QCS to keep an allocated buffer, particularly when no data is received anymore. Buffer is automatically reallocated if needed via qc_get_ncbuf().
This commit is contained in:
parent
7313f5ee7e
commit
8b87b15c22
@ -296,13 +296,17 @@ void qcs_consume(struct qcs *qcs, uint64_t bytes)
|
||||
{
|
||||
struct qcc *qcc = qcs->qcc;
|
||||
struct quic_frame *frm;
|
||||
struct ncbuf *buf = &qcs->rx.ncbuf;
|
||||
enum ncb_ret ret;
|
||||
|
||||
ret = ncb_advance(&qcs->rx.ncbuf, bytes);
|
||||
ret = ncb_advance(buf, bytes);
|
||||
if (ret) {
|
||||
ABORT_NOW(); /* should not happens because removal only in data */
|
||||
}
|
||||
|
||||
if (ncb_is_empty(buf))
|
||||
qc_free_ncbuf(qcs, buf);
|
||||
|
||||
qcs->rx.offset += bytes;
|
||||
if (qcs->rx.msd - qcs->rx.offset < qcs->rx.msd_init / 2) {
|
||||
frm = pool_zalloc(pool_head_quic_frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user