]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connections: Split CS_FL_RCV_MORE into 2 flags.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 6 Dec 2018 15:22:29 +0000 (16:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Dec 2018 15:36:05 +0000 (16:36 +0100)
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.

include/types/connection.h
src/mux_h1.c
src/mux_h2.c
src/stream_interface.c

index 8a12cec1d6446d6dd976dac7a5144d44f39b8d45..27c839f81fe87544da27487ab64fdb71aab299a8 100644 (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 */
index 3b845a6ec93e409d9807786754f4e4b04fbefa78..e1552346c98834b5856c441ad3ac4b9c3ac8443b 100644 (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;
        }
index 06ee7d798a3dcd77a364062ed52772c9fd2a9411..dd321ece0d77def49836b1273eb42b2444030520 100644 (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)) {
index 73d9d4f8e0883a626002cb0e586233df869ac85d..b4efe0c42905b3892dc6397f65e1cafc2abcd43a 100644 (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) {