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.
This commit is contained in:
Olivier Houchard 2018-12-06 16:22:29 +01:00 committed by Willy Tarreau
parent 939193a1a1
commit d247be0620
4 changed files with 7 additions and 6 deletions

View File

@ -78,7 +78,8 @@ enum {
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 */

View File

@ -1269,13 +1269,13 @@ static size_t h1_process_input(struct h1c *h1c, struct buffer *buf, int flags)
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;
}

View File

@ -4527,9 +4527,9 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
}
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)) {

View File

@ -1215,7 +1215,7 @@ int si_cs_recv(struct conn_stream *cs)
(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) {