]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: h2: unblock a connection when its current stream detaches
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Oct 2017 14:44:59 +0000 (15:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:16:18 +0000 (18:16 +0100)
If a stream is killed for whatever reason and it happens to be the one
currently blocking the connection, we must unblock the connection and
enable polling again so that it can attempt to make progress. This may
happen for example on upload timeout, where the demux is blocked due to
a full stream buffer, and the stream dies on server timeout and quits.

src/mux_h2.c

index 3b26a01eb6b5705352c7423628ecd806b9571b4c..b793c52db099b338ba0fd68207c74d106442e59e 100644 (file)
@@ -1628,6 +1628,17 @@ static void h2_detach(struct conn_stream *cs)
        h2c = h2s->h2c;
        h2s->cs = NULL;
 
+       if ((h2c->flags & H2_CF_DEM_BLOCK_ANY && h2s->id == h2c->dsi) ||
+           (h2c->flags & H2_CF_MUX_BLOCK_ANY && h2s->id == h2c->msi)) {
+               /* unblock the connection if it was blocked on this
+                * stream.
+                */
+               h2c->flags &= ~H2_CF_DEM_BLOCK_ANY;
+               h2c->flags &= ~H2_CF_MUX_BLOCK_ANY;
+               conn_xprt_want_recv(cs->conn);
+               conn_xprt_want_send(cs->conn);
+       }
+
        if (h2s->by_id.node.leaf_p) {
                /* h2s still attached to the h2c */
                eb32_delete(&h2s->by_id);