]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: make sure the demux also wakes streams up on errors
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Dec 2018 15:52:44 +0000 (16:52 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 18 Dec 2018 15:52:44 +0000 (16:52 +0100)
Today the demux only wakes a stream up after receiving some contents, but
not necessarily on close or error. Let's do it based on both error flags
and both EOS flags. With a bit of refinement we should be able to only do
it when the pending bits are there but not the static ones.

No backport is needed.

src/mux_h2.c

index a76ca0f3fd3bc932fedc069b55b6016829255311..862c188930194ada48a447d4502511cb83635da7 100644 (file)
@@ -2100,7 +2100,9 @@ static void h2_process_demux(struct h2c *h2c)
                /* Only H2_CS_FRAME_P and H2_CS_FRAME_A here */
                tmp_h2s = h2c_st_by_id(h2c, h2c->dsi);
 
-               if (tmp_h2s != h2s && h2s && h2s->cs && b_data(&h2s->rxbuf)) {
+               if (tmp_h2s != h2s && h2s && h2s->cs &&
+                   (b_data(&h2s->rxbuf) ||
+                    (h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_REOS)))) {
                        /* we may have to signal the upper layers */
                        h2s->cs->flags |= CS_FL_RCV_MORE;
                        if (h2s->recv_wait) {
@@ -2338,13 +2340,15 @@ static void h2_process_demux(struct h2c *h2c)
 
  fail:
        /* we can go here on missing data, blocked response or error */
-       if (h2s && h2s->cs && b_data(&h2s->rxbuf)) {
+       if (h2s && h2s->cs &&
+           (b_data(&h2s->rxbuf) ||
+            (h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_REOS)))) {
                /* we may have to signal the upper layers */
                h2s->cs->flags |= CS_FL_RCV_MORE;
                if (h2s->recv_wait) {
-                               h2s->recv_wait->wait_reason &= ~SUB_CAN_RECV;
-                               tasklet_wakeup(h2s->recv_wait->task);
-                               h2s->recv_wait = NULL;
+                       h2s->recv_wait->wait_reason &= ~SUB_CAN_RECV;
+                       tasklet_wakeup(h2s->recv_wait->task);
+                       h2s->recv_wait = NULL;
                }
        }