From 46230363af6cb9332580ce9a8594251f1aa365b5 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 17 Oct 2019 16:04:20 +0200 Subject: [PATCH] MINOR: mux-h1: Inherit send flags from the upper layer 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index a0adae6ca2..484a389a94 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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; -- 2.39.5