]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Do not reset a full RX buffer
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 27 Jan 2022 11:19:28 +0000 (12:19 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Jan 2022 15:37:55 +0000 (16:37 +0100)
As the RX buffer is not consumed by the sock i/o handler as soon as a datagram
is produced, when full an RX buffer must not be reset. The remaining room is
consumed without modifying it. The consumer has a represention of its contents:
a list of datagrams.

src/quic_sock.c

index 468cf64db65e9f721cd78cb459ebbeee65fb71ca..37e7f1b7c0869aa73feac835507c8291fbaa74ba 100644 (file)
@@ -173,7 +173,7 @@ void quic_sock_fd_iocb(int fd)
        struct quic_transport_params *params;
        /* Source address */
        struct sockaddr_storage saddr = {0};
-       size_t max_sz;
+       size_t max_sz, cspace;
        socklen_t saddrlen;
        struct quic_dgram *dgram, *dgramp, *new_dgram;
 
@@ -207,9 +207,10 @@ void quic_sock_fd_iocb(int fd)
 
        params = &l->bind_conf->quic_params;
        max_sz = params->max_udp_payload_size;
-       if (b_contig_space(buf) < max_sz) {
-               /* Note that when we enter this function, <buf> is always empty */
-               b_reset(buf);
+       cspace = b_contig_space(buf);
+       if (cspace < max_sz) {
+               /* Consume the remaining space */
+               b_add(buf, cspace);
                if (b_contig_space(buf) < max_sz)
                        goto out;
        }