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.
This commit is contained in:
Willy Tarreau 2018-12-18 16:52:44 +01:00
parent a8519357c5
commit 567beb8a91
1 changed files with 9 additions and 5 deletions

View 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;
}
}