BUG/MEDIUM: mux-h2: don't refrain from offering oneself a used buffer
Usually when calling offer_buffer(), we don't expect to offer it to
ourselves. But with h2 we have the same buffer_wait for the two directions
so we can unblock the recv path when completing a send(), or we can unblock
part of the mux buffer after sending the first few buffers that we managed
to collect. Thus it is important to always accept to wake up any requester.
A few parts of this patch could possibly be backported but earlier versions
already have other issues related to low-buffer condition so it's not sure
it's worth taking the risk to make things worse.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index c5a10df..e3c0bb0 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -428,7 +428,7 @@
{
if (bptr->size) {
b_free(bptr);
- offer_buffers(h2c->buf_wait.target, tasks_run_queue);
+ offer_buffers(NULL, tasks_run_queue);
}
}
@@ -442,7 +442,7 @@
count++;
}
if (count)
- offer_buffers(h2c->buf_wait.target, tasks_run_queue);
+ offer_buffers(NULL, tasks_run_queue);
}
/* returns the number of allocatable outgoing streams for the connection taking
@@ -2852,7 +2852,7 @@
}
if (released)
- offer_buffers(h2c->buf_wait.target, tasks_run_queue);
+ offer_buffers(NULL, tasks_run_queue);
/* wrote at least one byte, the buffer is not full anymore */
h2c->flags &= ~(H2_CF_MUX_MFULL | H2_CF_DEM_MROOM);
@@ -3062,7 +3062,7 @@
}
if (released)
- offer_buffers(h2c->buf_wait.target, tasks_run_queue);
+ offer_buffers(NULL, tasks_run_queue);
}
/* either we can release everything now or it will be done later once