]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proto_htx: Use conn_stream's info to set t_idle duration when possible
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 29 Nov 2018 14:23:46 +0000 (15:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 1 Dec 2018 16:37:27 +0000 (17:37 +0100)
On the client side, if si_get_cs_info() returns valid info, we use it to set
t_idle duration. Otherwise, we compute it using the stream's logs info.

src/proto_htx.c

index 00712d3cd83d72545b3fdc8c073013540ffd63ca..0e1abb6b7d35a63f21dbbfc0f41077b98c96be27 100644 (file)
@@ -98,8 +98,13 @@ int htx_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)
-               s->logs.t_idle = tv_ms_elapsed(&s->logs.tv_accept, &now) - s->logs.t_handshake;
+       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);
+       }
 
        /*
         * Now we quickly check if we have found a full valid request.