]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: connections: Wait until the connection is established to try to recv.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 7 Nov 2018 16:55:19 +0000 (17:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:41:50 +0000 (21:41 +0100)
Instead of trying to receive as soon as the connection is created, and to
eventually have to transfer subscription if we move connections, wait
until the connection is established before attempting to recv.

src/backend.c
src/stream.c

index 4d75df6fea2a745514da35467df16a64df522c84..d40202885d405fe5cad4af82afdb5f69a79cf026 100644 (file)
@@ -1061,16 +1061,12 @@ int connect_server(struct stream *s)
        struct server *srv;
        int reuse = 0;
        int err;
-       void *send_wait = NULL, *recv_wait = NULL;
 
        srv = objt_server(s->target);
        srv_cs = objt_cs(s->si[1].end);
        srv_conn = cs_conn(srv_cs);
-       if (srv_conn) {
+       if (srv_conn)
                reuse = s->target == srv_conn->target;
-               send_wait = srv_conn->send_wait;
-               recv_wait = srv_conn->recv_wait;
-       }
 
        if (srv && !reuse) {
                old_cs = srv_cs;
@@ -1171,9 +1167,6 @@ int connect_server(struct stream *s)
        if (!srv_cs)
                return SF_ERR_RESOURCE;
 
-       srv_conn->send_wait = send_wait;
-       srv_conn->recv_wait = recv_wait;
-
        if (!(s->flags & SF_ADDR_SET)) {
                err = assign_server_address(s);
                if (err != SRV_STATUS_OK)
index f4473e86d0ccf97d613d6ea2a3808e98d30534d9..7b601ac44664aa109132f1348d2f239682f3546a 100644 (file)
@@ -862,6 +862,12 @@ static void sess_establish(struct stream *s)
                /* real connections have timeouts */
                req->wto = s->be->timeout.server;
                rep->rto = s->be->timeout.server;
+               /* The connection is now established, try to read data from the
+                * underlying layer, and subscribe to recv events. We use a
+                * delayed recv here to give a chance to the data to flow back
+                * by the time we process other tasks.
+                */
+               si_chk_rcv(si);
        }
        req->wex = TICK_ETERNITY;
 }