From: Willy Tarreau Date: Fri, 31 Jul 2020 07:16:23 +0000 (+0200) Subject: MINOR: mux-h1: do not try to receive on backend before sending a request X-Git-Tag: v2.3-dev2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5ea3a8c5818040420e27fd70d5bb8e867acdb4b;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: do not try to receive on backend before sending a request There's no point trying to perform an recv() on a back connection if we have a stream before having sent a request, as it's expected to fail. It's likely that this may avoid some spurious subscribe() calls in some keep-alive cases (the close case was already addressed at the connection level by "MINOR: connection: avoid a useless recvfrom() on outgoing connections"). --- diff --git a/src/mux_h1.c b/src/mux_h1.c index ea52119a9f..5c68d09c64 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -368,6 +368,11 @@ static inline int h1_recv_allowed(const struct h1c *h1c) return 0; } + if (conn_is_back(h1c->conn) && h1c->h1s && h1c->h1s->req.state == H1_MSG_RQBEFORE) { + TRACE_DEVEL("recv not allowed because back and request not sent yet", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn); + return 0; + } + if (!(h1c->flags & (H1C_F_IN_ALLOC|H1C_F_IN_FULL|H1C_F_IN_BUSY))) return 1;