]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: do not try to receive on backend before sending a request
authorWilly Tarreau <w@1wt.eu>
Fri, 31 Jul 2020 07:16:23 +0000 (09:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 31 Jul 2020 07:30:12 +0000 (09:30 +0200)
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").

src/mux_h1.c

index ea52119a9fe5f161418ad7a53a348bd34205145f..5c68d09c64919d4f6abc4fb243c8f08b2dcff43c 100644 (file)
@@ -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;