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.
This commit is contained in:
Willy Tarreau 2014-04-23 00:35:17 +02:00
parent 62ba870f52
commit b9a551e6aa
2 changed files with 2 additions and 1 deletions

View File

@ -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++;
}

View File

@ -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