BUG/MEDIUM: connections: Split CS_FL_RCV_MORE into 2 flags.
CS_FL_RCV_MORE is used in two cases, to let the conn_stream
know there may be more data available, and to let it know that
it needs more room. We can't easily differentiate between the
two, and that may leads to hangs, so split it into two flags,
CS_FL_RCV_MORE, that means there may be more data, and
CS_FL_WANT_ROOM, that means we need more room.
This should not be backported.
diff --git a/include/types/connection.h b/include/types/connection.h
index 8a12cec..27c839f 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -78,7 +78,8 @@
CS_FL_ERROR = 0x00000100, /* a fatal error was reported */
- CS_FL_RCV_MORE = 0x00000200, /* more bytes to receive but not enough room */
+ CS_FL_RCV_MORE = 0x00000200, /* We may have more bytes to transfert */
+ CS_FL_WANT_ROOM = 0x00000400, /* More bytes to transfert, but not enough room */
CS_FL_EOS = 0x00001000, /* End of stream delivered to data layer */
CS_FL_REOS = 0x00002000, /* End of stream received (buffer not empty) */
CS_FL_WAIT_FOR_HS = 0x00010000, /* This stream is waiting for handhskae */
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 3b845a6..e155234 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -1269,13 +1269,13 @@
if (b_data(&h1c->ibuf)) {
if (!htx_is_empty(htx))
- h1s->cs->flags |= CS_FL_RCV_MORE;
+ h1s->cs->flags |= CS_FL_RCV_MORE | CS_FL_WANT_ROOM;
}
else {
h1_release_buf(h1c, &h1c->ibuf);
h1_sync_messages(h1c);
- h1s->cs->flags &= ~CS_FL_RCV_MORE;
+ h1s->cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
if (h1s->cs->flags & CS_FL_REOS)
h1s->cs->flags |= CS_FL_EOS;
}
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 06ee7d7..dd321ec 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -4527,9 +4527,9 @@
}
if (b_data(&h2s->rxbuf))
- cs->flags |= CS_FL_RCV_MORE;
+ cs->flags |= (CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
else {
- cs->flags &= ~CS_FL_RCV_MORE;
+ cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
if (cs->flags & CS_FL_REOS)
cs->flags |= CS_FL_EOS;
if (b_size(&h2s->rxbuf)) {
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 73d9d4f..b4efe0c 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1215,7 +1215,7 @@
(co_data(ic) ? CO_RFL_BUF_WET : 0) |
((channel_recv_limit(ic) < b_size(&ic->buf)) ? CO_RFL_KEEP_RSV : 0));
- if (b_data(&ic->buf) && (cs->flags & CS_FL_RCV_MORE))
+ if (cs->flags & CS_FL_WANT_ROOM)
si_rx_room_blk(si);
if (cs->flags & CS_FL_READ_PARTIAL) {