]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: conn_stream: Add a flag to notify the mux it should flush its buffers
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 Oct 2018 13:56:04 +0000 (15:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:45:48 +0000 (21:45 +0100)
By setting the flag CO_RFL_BUF_FLUSH when calling mux->rcv_buf, the
stream-interface notifies the mux it should flush its buffers without reading
more data. This flag is set when the SI want to use the kernel TCP splicing to
forward data. Of course, the mux can respect it or not, depending on its
state. It's just an information.

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

index a85343bddaa706248c61e4594de24457c026883b..5af651ff5172baa1b277d69a806418a5956a3e6f 100644 (file)
@@ -258,6 +258,7 @@ enum {
 /* flags that can be passed to xprt->rcv_buf() and mux->rcv_buf() */
 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 */
 };
 
 /* flags that can be passed to xprt->snd_buf() and mux->snd_buf() */
index 22c329fc15ea98bd26ca670811b225bab0582236..8742a400f6773bd979787ebeccbad9fec412bf0b 100644 (file)
@@ -1090,6 +1090,7 @@ int si_cs_recv(struct conn_stream *cs)
        struct channel *ic = si_ic(si);
        int ret, max, cur_read = 0;
        int read_poll = MAX_READ_POLL_LOOPS;
+       int flags = 0;
 
        /* stop immediately on errors. Note that we DON'T want to stop on
         * POLL_ERR, as the poller might report a write error while there
@@ -1141,6 +1142,7 @@ int si_cs_recv(struct conn_stream *cs)
                         * locations at a time. Let's indicate we need some
                         * place and ask the consumer to hurry.
                         */
+                       flags |= CO_RFL_BUF_FLUSH;
                        goto abort_splice;
                }
 
@@ -1208,8 +1210,7 @@ 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, 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));
                if (cs->flags & CS_FL_RCV_MORE)
                        si_rx_room_blk(si);