]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: quic: realign empty Rx buffer
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 17 May 2022 13:01:25 +0000 (15:01 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 May 2022 13:16:26 +0000 (15:16 +0200)
quic_rx_pkts_del() function removes packets from QUIC RX buffer. In most
cases, the buffer will be emptied after it. In this case, it's useful to
realign it. This will avoid future data wrapping and use of an
unnecessary junk to fill a too small contiguous space.

include/haproxy/xprt_quic.h

index 967a43d8dda4ae5da6542f5e556f3cb2fb68b67f..ce65e8bf865f2ca2833b1399bb178f4349ab2472 100644 (file)
@@ -1149,6 +1149,9 @@ static inline void quic_rx_pkts_del(struct quic_conn *qc)
                LIST_DELETE(&pkt->qc_rx_pkt_list);
                pool_free(pool_head_quic_rx_packet, pkt);
        }
+
+       /* In frequent cases the buffer will be emptied at this stage. */
+       b_realign_if_empty(&qc->rx.buf);
 }
 
 /* Increment the reference counter of <pkt> */