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").
This commit is contained in:
Willy Tarreau 2020-07-31 09:16:23 +02:00
parent 2febb846a4
commit f5ea3a8c58

View 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;