From ccf973f5efe313f10ffa8b002832fc69e5268ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Mon, 20 Dec 2021 17:12:42 +0100 Subject: [PATCH] MINOR: quic: Stop emptying the RX buffer asap. When a packet is present in the RX buffer at the first place but without a null reference counter, there is no need to continue to try to empty the buffer, it is sure the next packet will not be at the first place! --- include/haproxy/xprt_quic.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index b731da27a..13de0f196 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -1083,11 +1083,12 @@ static inline void quic_rx_pkts_del(struct quic_conn *qc) break; } - if (!HA_ATOMIC_LOAD(&pkt->refcnt)) { - b_del(&qc->rx.buf, pkt->raw_len); - LIST_DELETE(&pkt->qc_rx_pkt_list); - pool_free(pool_head_quic_rx_packet, pkt); - } + if (HA_ATOMIC_LOAD(&pkt->refcnt)) + break; + + b_del(&qc->rx.buf, pkt->raw_len); + LIST_DELETE(&pkt->qc_rx_pkt_list); + pool_free(pool_head_quic_rx_packet, pkt); } }