From: Christopher Faulet Date: Fri, 9 Apr 2021 09:58:49 +0000 (+0200) Subject: MINOR: mux-h1: Always subscribe for reads when splicing is disabled X-Git-Tag: v2.4-dev19~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94d35108b48b97b578024c97ec4a4840441cbcfc;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: Always subscribe for reads when splicing is disabled In h1_rcv_pipe(), when the splicing is not possible or disabled at the end of the fnuction, we make sure to subscribe for reads. It is not a bug but it avoid an extra call to h1_rcv_pipe() to handle the subscription in some cases (end of message, end of chunk or read0). In addition, the condition to detect end of splicing has been simplified. We now only rely on H1C_F_WANT_SPLICE flags. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index a1cf3f9d41..04a90e8c89 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3432,10 +3432,6 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c if ((h1m->flags & H1_MF_CHNK) || (h1m->state != H1_MSG_DATA && h1m->state != H1_MSG_TUNNEL)) { h1c->flags &= ~H1C_F_WANT_SPLICE; TRACE_STATE("Allow xprt rcv_buf on !(msg_data|msg_tunnel)", H1_EV_STRM_RECV, cs->conn, h1s); - if (!(h1c->wait_event.events & SUB_RETRY_RECV)) { - TRACE_STATE("restart receiving data, subscribing", H1_EV_STRM_RECV, cs->conn, h1s); - cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); - } goto end; } @@ -3467,11 +3463,13 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c TRACE_STATE("Allow xprt rcv_buf on read0", H1_EV_STRM_RECV, cs->conn, h1s); } - if ((h1s->flags & H1S_F_REOS) || - (h1m->state != H1_MSG_TUNNEL && h1m->state != H1_MSG_DATA) || - (h1m->state == H1_MSG_DATA && !h1m->curr_len)) { + if (!(h1c->flags & H1C_F_WANT_SPLICE)) { TRACE_STATE("notify the mux can't use splicing anymore", H1_EV_STRM_RECV, h1c->conn, h1s); cs->flags &= ~CS_FL_MAY_SPLICE; + if (!(h1c->wait_event.events & SUB_RETRY_RECV)) { + TRACE_STATE("restart receiving data, subscribing", H1_EV_STRM_RECV, cs->conn, h1s); + cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); + } } TRACE_LEAVE(H1_EV_STRM_RECV, cs->conn, h1s, 0, (size_t[]){ret});