[MEDIUM] session: initialize server-side timeouts after connect()

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.
This commit is contained in:
Willy Tarreau 2010-05-31 12:31:35 +02:00
parent 85e7d00a70
commit d04e858db0
4 changed files with 9 additions and 5 deletions

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

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

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

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