]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] session: initialize server-side timeouts after connect()
authorWilly Tarreau <w@1wt.eu>
Mon, 31 May 2010 10:31:35 +0000 (12:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Jun 2010 08:53:14 +0000 (10:53 +0200)
It was particularly embarrassing that the server timeout was assigned
to buffers during an accept() just to be potentially changed later in
case of a use_backend rule. The frontend side has nothing to do with
server timeouts.

Now we initialize them right after the connect() succeeds. Later this
should change for a unique stream-interface timeout setting only.

src/frontend.c
src/proto_http.c
src/proxy.c
src/session.c

index a51231e50879e1dd307a987195f3c50792788492..cdd46cef49aa61b74c0cd7a22ee5957631b25a6a 100644 (file)
@@ -351,7 +351,7 @@ int frontend_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        }
 
        s->req->rto = s->fe->timeout.client;
-       s->req->wto = s->be->timeout.server;
+       s->req->wto = TICK_ETERNITY;
 
        if (unlikely((s->rep = pool_alloc2(pool2_buffer)) == NULL))
                goto out_fail_rep; /* no memory */
@@ -363,7 +363,7 @@ int frontend_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        s->si[0].ob = s->si[1].ib = s->rep;
        s->rep->analysers = 0;
 
-       s->rep->rto = s->be->timeout.server;
+       s->rep->rto = TICK_ETERNITY;
        s->rep->wto = s->fe->timeout.client;
 
        s->req->rex = TICK_ETERNITY;
index b533c2d341f2a9940fa1b2889f76589f7b84171b..a1ff02c84aad6b43d24f498bdbbcceb71de99ebe 100644 (file)
@@ -6746,9 +6746,9 @@ void http_reset_txn(struct session *s)
        }
 
        s->req->rto = s->fe->timeout.client;
-       s->req->wto = s->be->timeout.server;
+       s->req->wto = TICK_ETERNITY;
 
-       s->rep->rto = s->be->timeout.server;
+       s->rep->rto = TICK_ETERNITY;
        s->rep->wto = s->fe->timeout.client;
 
        s->req->rex = TICK_ETERNITY;
index 6b038777d24e011896796e8cf682cd2fb7320f6f..98ff94db36448df9beb292dd104df342cc5d461e 100644 (file)
@@ -719,7 +719,6 @@ int session_set_backend(struct session *s, struct proxy *be)
        proxy_inc_be_ctr(be);
 
        /* assign new parameters to the session from the new backend */
-       s->rep->rto = s->req->wto = be->timeout.server;
        s->conn_retries = be->conn_retries;
        s->si[1].flags &= ~SI_FL_INDEP_STR;
        if (be->options2 & PR_O2_INDEPSTR)
index ec8d07b38e0592098506959226e10eb0ab8e1deb..08bb4c315edc2eba3e92ec42711064a900f8bb64 100644 (file)
@@ -347,6 +347,11 @@ void sess_establish(struct session *s, struct stream_interface *si)
 
        rep->analysers |= s->fe->fe_rsp_ana | s->be->be_rsp_ana;
        rep->flags |= BF_READ_ATTACHED; /* producer is now attached */
+       if (si->connect) {
+               /* real connections have timeouts */
+               req->wto = s->be->timeout.server;
+               rep->rto = s->be->timeout.server;
+       }
        req->wex = TICK_ETERNITY;
 }