]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h1: Notify the stream waiting for TCP splicing if ibuf is empty
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Apr 2019 11:55:08 +0000 (13:55 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 17 Apr 2019 12:52:31 +0000 (14:52 +0200)
When a stream-interface want to use the TCP splicing to forward its data, it
notifies the mux h1. We will then flush the input buffer and don't read more
data. So the stream-interface will not be notified for read anymore, except if
an error or a read0 is detected. It is a problem everytime the receive I/O
callback is called again. It happens when the pipe is full or when no data are
received on the pipe. It also happens when the input buffer is freshly
flushed. Because the TCP splicing is enabled, nothing is done in h1_recv() and
the stream-interface is never woken up. So, now, in h1_recv(), if the TCP
splicing is used and the input buffer is empty, the stream-interface is notified
for read.

This patch must be backported to 1.9.

src/mux_h1.c

index 32da39980e094a861f99f19a88954dc883f6e79a..b5e47c680dfb0c3020fd32172b8216fe604f2cad 100644 (file)
@@ -1723,13 +1723,15 @@ static int h1_recv(struct h1c *h1c)
                goto end;
        }
 
-       if (h1s && (h1s->flags & (H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA))) {
-               rcvd = 1;
+       if (!h1_get_buf(h1c, &h1c->ibuf)) {
+               h1c->flags |= H1C_F_IN_ALLOC;
                goto end;
        }
 
-       if (!h1_get_buf(h1c, &h1c->ibuf)) {
-               h1c->flags |= H1C_F_IN_ALLOC;
+       if (h1s && (h1s->flags & (H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA))) {
+               if (!b_data(&h1c->ibuf))
+                       h1_wake_stream_for_recv(h1s);
+               rcvd = 1;
                goto end;
        }