]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: h2: enable reading again on the connection if it was blocked on stream buffer...
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Oct 2017 14:38:23 +0000 (15:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:16:18 +0000 (18:16 +0100)
If the polling update function is called with RD_ENA while H2_CF_DEM_SFULL
indicates the demux had to block on a stream buffer full condition, we can
remove the flag and re-enable polling for receiving because this is the
indication that a consumer stream has made some room in the buffer. Probably
that we should improve this to ensure that h2s->id == h2c->dsi and avoid
trying to receive multiple times in a row for the wrong stream.

src/mux_h2.c

index f05c2693937031513e95e90be0428b17476c89ad..e9f1bc856c1dd9815baf2eabe0b429df23f54b72 100644 (file)
@@ -943,6 +943,14 @@ static void h2_update_poll(struct conn_stream *cs)
        if (!h2s)
                return;
 
+       /* we may unblock a blocked read */
+
+       if (cs->flags & CS_FL_DATA_RD_ENA &&
+           h2s->h2c->flags & H2_CF_DEM_SFULL && h2s->h2c->dsi == h2s->id) {
+               h2s->h2c->flags &= ~H2_CF_DEM_SFULL;
+               conn_xprt_want_recv(cs->conn);
+       }
+
        /* Note: the stream and stream-int code doesn't allow us to perform a
         * synchronous send() here unfortunately, because this code is called
         * as si_update() from the process_stream() context. This means that