]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Inherit send flags from the upper layer
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Oct 2019 14:04:20 +0000 (16:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 20 Jan 2020 14:18:45 +0000 (15:18 +0100)
Send flags (CO_SFL_*) used when xprt->snd_buf() is called, in h1_send(), are now
inherited from the upper layer, when h1_snd_buf() is called. First, the flag
CO_SFL_MSG_MORE is no more set if the output buffer is full, but only if the
stream-interface decides to set it. It has more info to do it than the
mux. Then, the flag CO_SFL_STREAMER is now also handled this way. It was just
ignored till now.

src/mux_h1.c

index a0adae6ca2163077db4e92be49c82aadc2657dbe..484a389a94d03c83c01a1a91cf403f82a36241ac 100644 (file)
@@ -57,6 +57,9 @@
 #define H1C_F_WAIT_NEXT_REQ  0x00010000 /*  waiting for the next request to start, use keep-alive timeout */
 #define H1C_F_UPG_H2C        0x00020000 /* set if an upgrade to h2 should be done */
 
+#define H1C_F_CO_MSG_MORE    0x00040000 /* set if CO_SFL_MSG_MORE must be set when calling xprt->snd_buf() */
+#define H1C_F_CO_STREAMER    0x00080000 /* set if CO_SFL_STREAMER must be set when calling xprt->snd_buf() */
+
 /*
  * H1 Stream flags (32 bits)
  */
@@ -2095,8 +2098,10 @@ static int h1_send(struct h1c *h1c)
        if (!b_data(&h1c->obuf))
                goto end;
 
-       if (h1c->flags & H1C_F_OUT_FULL)
+       if (h1c->flags & H1C_F_CO_MSG_MORE)
                flags |= CO_SFL_MSG_MORE;
+       if (h1c->flags & H1C_F_CO_STREAMER)
+               flags |= CO_SFL_STREAMER;
 
        ret = conn->xprt->snd_buf(conn, conn->xprt_ctx, &h1c->obuf, b_data(&h1c->obuf), flags);
        if (ret > 0) {
@@ -2668,6 +2673,13 @@ static size_t h1_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
                return 0;
        }
 
+       /* Inherit some flags from the upper layer */
+       h1c->flags &= ~(H1C_F_CO_MSG_MORE|H1C_F_CO_STREAMER);
+       if (flags & CO_SFL_MSG_MORE)
+               h1c->flags |= H1C_F_CO_MSG_MORE;
+       if (flags & CO_SFL_STREAMER)
+               h1c->flags |= H1C_F_CO_STREAMER;
+
        while (count) {
                size_t ret = 0;