]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: don't try to recv() before the connection is ready
authorWilly Tarreau <w@1wt.eu>
Mon, 3 Jun 2019 08:12:22 +0000 (10:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 3 Jun 2019 08:17:12 +0000 (10:17 +0200)
Just as we already do in h1_send(), if the connection is not yet ready,
do not proceed and instead subscribe. This avoids a needless recvfrom()
and subscription to polling for a case which will never work since the
request was not even sent.

src/mux_h1.c

index 32d1f79de6a9c90f926dd65e96ebb60c54540bde..34a8d0385cd32f1a2767373fa0321f142a8168b0 100644 (file)
@@ -1742,6 +1742,11 @@ static int h1_recv(struct h1c *h1c)
        if (h1c->wait_event.events & SUB_RETRY_RECV)
                return (b_data(&h1c->ibuf));
 
+       if (h1c->flags & H1C_F_CS_WAIT_CONN) {
+               conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
+               return 0;
+       }
+
        if (!h1_recv_allowed(h1c)) {
                rcvd = 1;
                goto end;