]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: conn_stream: Add a flag to notify the mux it must respect the reserve
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 17 Oct 2018 09:08:23 +0000 (11:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:45:48 +0000 (21:45 +0100)
By setting the flag CO_RFL_KEEP_RSV when calling mux->rcv_buf, the
stream-interface notifies the mux it must keep some space to preserve the
buffer's reserve. This flag is only useful for multiplexers handling structured
data, because in such case, the stream-interface cannot know the real amount of
free space in the channel's buffer.

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

index 5af651ff5172baa1b277d69a806418a5956a3e6f..72562194dc0d35249c2fdd5ee462da4369f6f94c 100644 (file)
@@ -259,6 +259,7 @@ enum {
 enum {
        CO_RFL_BUF_WET     = 0x0001,    /* Buffer still has some output data present */
        CO_RFL_BUF_FLUSH   = 0x0002,    /* Flush mux's buffers but don't read more data */
+       CO_RFL_KEEP_RSV    = 0x0004,    /* Don't fill the reserved space */
 };
 
 /* flags that can be passed to xprt->snd_buf() and mux->snd_buf() */
index 8742a400f6773bd979787ebeccbad9fec412bf0b..3c7284f6c98a9049e7b67159fdd4963b1dcf9b5c 100644 (file)
@@ -1210,7 +1210,10 @@ int si_cs_recv(struct conn_stream *cs)
                 * CS_FL_RCV_MORE on the CS if more space is needed.
                 */
                max = channel_recv_max(ic);
-               ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, flags | (co_data(ic) ? CO_RFL_BUF_WET : 0));
+               ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max,
+                         flags |
+                         (co_data(ic) ? CO_RFL_BUF_WET : 0) |
+                         ((channel_recv_limit(ic) < b_size(&ic->buf)) ? CO_RFL_KEEP_RSV : 0));
                if (cs->flags & CS_FL_RCV_MORE)
                        si_rx_room_blk(si);