From b9a551e6aaf1e644f0d447c6e0519558c0efd7b1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 23 Apr 2014 00:35:17 +0200 Subject: [PATCH] BUG/MINOR: stats: last session was not always set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- src/backend.c | 1 - src/session.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) 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 -- 2.47.3