From 1712b1df595eb66b1234f2f089208b408e18ba07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Fri, 28 Jan 2022 13:10:24 +0100 Subject: [PATCH] MINOR: quic: Wrong RX buffer tail handling when no more contiguous data The producer must know where is the tailing hole in the RX buffer when it purges it from consumed datagram. This is done allocating a fake datagram with the remaining number of bytes which cannot be produced at the tail of the RX buffer as length. --- src/quic_sock.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/quic_sock.c b/src/quic_sock.c index 37e7f1b7c..5533b01d5 100644 --- a/src/quic_sock.c +++ b/src/quic_sock.c @@ -209,6 +209,17 @@ void quic_sock_fd_iocb(int fd) max_sz = params->max_udp_payload_size; cspace = b_contig_space(buf); if (cspace < max_sz) { + struct quic_dgram *dgram; + + /* Allocate a fake datagram, without data to locate + * the end of the RX buffer (required during purging). + */ + dgram = pool_zalloc(pool_head_quic_dgram); + if (!dgram) + goto out; + + dgram->len = cspace; + LIST_APPEND(&rxbuf->dgrams, &dgram->list); /* Consume the remaining space */ b_add(buf, cspace); if (b_contig_space(buf) < max_sz)