From 8b19a9f162a66205b802ced4feae6ee46021e87c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 4 Aug 2021 15:10:32 +0200 Subject: [PATCH] MINOR: quic: Make use of the last cbuf API when initializing TX ring buffers Initialize the circular buffer internal buffer from a specific pool for TX ring buffers named "pool_head_quic_tx_ring". --- src/proto_quic.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/proto_quic.c b/src/proto_quic.c index 1e2ca5786b..257a49204b 100644 --- a/src/proto_quic.c +++ b/src/proto_quic.c @@ -537,20 +537,29 @@ static int quic_alloc_rings_listener(struct listener *l) MT_LIST_INIT(&l->rx.tx_qrings); for (i = 0; i < global.nbthread; i++) { + unsigned char *buf; struct qring *qr = &l->rx.qrings[i]; - qr->cbuf = cbuf_new(); - if (!qr->cbuf) + buf = pool_alloc(pool_head_quic_tx_ring); + if (!buf) goto err; + qr->cbuf = cbuf_new(buf, QUIC_TX_RING_BUFSZ); + if (!qr->cbuf) { + pool_free(pool_head_quic_tx_ring, buf); + goto err; + } + MT_LIST_APPEND(&l->rx.tx_qrings, &qr->mt_list); } return 1; err: - while ((qr = MT_LIST_POP(&l->rx.tx_qrings, typeof(qr), mt_list))) + while ((qr = MT_LIST_POP(&l->rx.tx_qrings, typeof(qr), mt_list))) { + pool_free(pool_head_quic_tx_ring, qr->cbuf->buf); cbuf_free(qr->cbuf); + } free(l->rx.qrings); return 0; } -- 2.39.5