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 4e6dc30..7390ba1 100644
--- a/src/log.c
+++ b/src/log.c
@@ -2132,7 +2132,7 @@
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;