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.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index a76ca0f..862c188 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -2100,7 +2100,9 @@
/* 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 @@
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;
}
}