]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: Always get idle duration from the session
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Sep 2020 11:49:56 +0000 (13:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:48 +0000 (14:41 +0100)
Since the idle duration provided by the session is always up-to-date, there
is no more reason to rely on the multiplexer cs_info to set it to the
stream.

src/http_ana.c
src/stream.c

index d89b7d5d7ca83f445b3b85a44bb281b89c103cb4..6659f7e7b36efbb881cb771bf5b1c421056eb37c 100644 (file)
@@ -109,13 +109,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
        s->srv_error = http_return_srv_error;
 
        /* If there is data available for analysis, log the end of the idle time. */
-       if (c_data(req) && s->logs.t_idle == -1) {
-               const struct cs_info *csinfo = si_get_cs_info(objt_cs(s->si[0].end));
-
-               s->logs.t_idle = ((csinfo)
-                                 ? csinfo->t_idle
-                                 : tv_ms_elapsed(&s->logs.tv_accept, &now) - s->logs.t_handshake);
-       }
+       if (c_data(req) && s->logs.t_idle == -1)
+               s->logs.t_idle = sess->t_idle;
 
        /*
         * Now we quickly check if we have found a full valid request.
index 15ea23d09d6a8f6281ada8ca6781e5882769837f..49654bdb313f4f5f5aa346ddb92f631424a0d475 100644 (file)
@@ -351,14 +351,13 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin)
                s->logs.accept_date = csinfo->create_date;
                s->logs.tv_accept = csinfo->tv_create;
                s->logs.t_handshake = csinfo->t_handshake;
-               s->logs.t_idle = csinfo->t_idle;
        }
        else {
                s->logs.accept_date = sess->accept_date;
                s->logs.tv_accept = sess->tv_accept;
                s->logs.t_handshake = sess->t_handshake;
-               s->logs.t_idle = -1;
        }
+       s->logs.t_idle = sess->t_idle;
 
        /* default logging function */
        s->do_log = strm_log;