From dd78921c66ea1440676b06200064c9a27f82c50d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 30 Sep 2020 15:10:07 +0200 Subject: [PATCH] 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). --- src/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.39.5