From: Willy Tarreau Date: Mon, 3 Jun 2019 08:12:22 +0000 (+0200) Subject: MINOR: mux-h1: don't try to recv() before the connection is ready X-Git-Tag: v2.0-dev6~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d58f27feadbc71c947fa0810f49552a94c60dc9a;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: don't try to recv() before the connection is ready 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. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 32d1f79de6..34a8d0385c 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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;