From: Christopher Faulet Date: Wed, 30 Sep 2020 13:10:07 +0000 (+0200) Subject: MINOR: logs: Use session idle duration when no stream is provided X-Git-Tag: v2.4-dev3~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd78921c66ea1440676b06200064c9a27f82c50d;p=thirdparty%2Fhaproxy.git MINOR: logs: Use session idle duration when no stream is provided When a log message is emitted from the session, using sess_log() function, there is no stream available. In this case, instead of deducing the idle duration from the accept date, we use the one provided by the session. 0 is used if it is undefined (i.e set to -1). --- diff --git a/src/log.c b/src/log.c index 4e6dc30084..7390ba183d 100644 --- a/src/log.c +++ b/src/log.c @@ -2132,7 +2132,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t tmp_strm_log.tv_accept = sess->tv_accept; tmp_strm_log.accept_date = sess->accept_date; tmp_strm_log.t_handshake = sess->t_handshake; - tmp_strm_log.t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake; + tmp_strm_log.t_idle = (sess->t_idle >= 0 ? sess->t_idle : 0); tv_zero(&tmp_strm_log.tv_request); tmp_strm_log.t_queue = -1; tmp_strm_log.t_connect = -1;