mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: session: factor out the connect time measurement
Currently there are 3 places in the code where t_connect is set after switching to state SI_ST_EST, and a fourth one will soon come. Since all these places lead to an immediate call to sess_establish() to complete the session establishment, better move that measurement there.
This commit is contained in:
parent
c920096993
commit
0e37f1c40e
@ -785,8 +785,6 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
|
|||||||
* so we need to pretend we're established to log correctly
|
* so we need to pretend we're established to log correctly
|
||||||
* and let later states handle the failure.
|
* and let later states handle the failure.
|
||||||
*/
|
*/
|
||||||
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
|
||||||
si->exp = TICK_ETERNITY;
|
|
||||||
si->state = SI_ST_EST;
|
si->state = SI_ST_EST;
|
||||||
si->err_type = SI_ET_DATA_ERR;
|
si->err_type = SI_ET_DATA_ERR;
|
||||||
si->ib->flags |= CF_READ_ERROR | CF_WRITE_ERROR;
|
si->ib->flags |= CF_READ_ERROR | CF_WRITE_ERROR;
|
||||||
@ -828,8 +826,6 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
|
|||||||
/* OK, this means that a connection succeeded. The caller will be
|
/* OK, this means that a connection succeeded. The caller will be
|
||||||
* responsible for handling the transition from CON to EST.
|
* responsible for handling the transition from CON to EST.
|
||||||
*/
|
*/
|
||||||
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
|
||||||
si->exp = TICK_ETERNITY;
|
|
||||||
si->state = SI_ST_EST;
|
si->state = SI_ST_EST;
|
||||||
si->err_type = SI_ET_NONE;
|
si->err_type = SI_ET_NONE;
|
||||||
return 1;
|
return 1;
|
||||||
@ -929,6 +925,10 @@ static void sess_establish(struct session *s, struct stream_interface *si)
|
|||||||
struct channel *req = si->ob;
|
struct channel *req = si->ob;
|
||||||
struct channel *rep = si->ib;
|
struct channel *rep = si->ib;
|
||||||
|
|
||||||
|
/* First, centralize the timers information */
|
||||||
|
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
|
si->exp = TICK_ETERNITY;
|
||||||
|
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
health_adjust(objt_server(s->target), HANA_STATUS_L4_OK);
|
health_adjust(objt_server(s->target), HANA_STATUS_L4_OK);
|
||||||
|
|
||||||
@ -1188,10 +1188,8 @@ static void sess_prepare_conn_req(struct session *s, struct stream_interface *si
|
|||||||
}
|
}
|
||||||
|
|
||||||
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
|
||||||
si->state = SI_ST_EST;
|
si->state = SI_ST_EST;
|
||||||
si->err_type = SI_ET_NONE;
|
si->err_type = SI_ET_NONE;
|
||||||
si->exp = TICK_ETERNITY;
|
|
||||||
/* let sess_establish() finish the job */
|
/* let sess_establish() finish the job */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user