From: Willy Tarreau Date: Tue, 22 Apr 2014 22:35:17 +0000 (+0200) Subject: BUG/MINOR: stats: last session was not always set X-Git-Tag: v1.5-dev23~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9a551e6aaf1e644f0d447c6e0519558c0efd7b1;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats: last session was not always set Cyril Bonté reported that the "lastsess" field of a stats-only backend was never updated. In fact the same is true for any applet and anything not a server. Also, lastsess was not updated for a server reusing its connection for a new request. Since the goal of this field is to report recent activity, it's better to ensure that all accesses are reported. The call has been moved to the code validating the session establishment instead, since everything passes there. --- diff --git a/src/backend.c b/src/backend.c index 7d0be1b701..e350af9af2 100644 --- a/src/backend.c +++ b/src/backend.c @@ -674,7 +674,6 @@ int assign_server(struct session *s) goto out; } else if (srv != prev_srv) { - be_set_sess_last(s->be); s->be->be_counters.cum_lbconn++; srv->counters.cum_lbconn++; } diff --git a/src/session.c b/src/session.c index 753d6cc941..b37348967a 100644 --- a/src/session.c +++ b/src/session.c @@ -1180,6 +1180,7 @@ 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); si->state = SI_ST_EST; si->err_type = SI_ET_NONE; + be_set_sess_last(s->be); /* let sess_establish() finish the job */ return; } @@ -1207,6 +1208,7 @@ static void sess_prepare_conn_req(struct session *s, struct stream_interface *si /* The server is assigned */ s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); si->state = SI_ST_ASS; + be_set_sess_last(s->be); } /* This stream analyser checks the switching rules and changes the backend