From 567beb8a910d0ae86fca6d856090be0a294ded4c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 18 Dec 2018 16:52:44 +0100 Subject: [PATCH] BUG/MEDIUM: mux-h2: make sure the demux also wakes streams up on errors 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 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index a76ca0f3fd..862c188930 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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; } }