]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: session: Add the idle duration field into the session
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Sep 2020 08:28:02 +0000 (10:28 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:48 +0000 (14:41 +0100)
The idle duration between two streams is added to the session structure. It
is not necessarily pertinent on all protocols. In fact, it is only defined
for H1 connections. It is the duration between two H1 transactions. But the
.get_cs_info() callback function on the multiplexers only exists because
this duration is missing at the session level. So it is a simplification
opportunity for a really low cost.

To reduce the cost, a hole in the session structure is filled by moving
.srv_list field at the end of the structure.

include/haproxy/session-t.h
src/session.c

index 3bb753acff1b277c1798f86d720aed2f79d32406..45b820cb395dcc6d69e78148a241d82805353087 100644 (file)
@@ -54,9 +54,10 @@ struct session {
        struct vars vars;               /* list of variables for the session scope. */
        struct task *task;              /* handshake timeout processing */
        long t_handshake;               /* handshake duration, -1 = not completed */
+       long t_idle;                    /* idle duration, -1 if never occurs */
        int idle_conns;                 /* Number of connections we're currently responsible for that we are not using */
-       struct list srv_list;           /* List of servers and the connections the session is currently responsible for */
        unsigned int flags;             /* session flags, SESS_FL_* */
+       struct list srv_list;           /* List of servers and the connections the session is currently responsible for */
 };
 
 struct sess_srv_list {
index 710b6b6f61369aa15a7195bcc05a689a2bfef930..07828df96791b512a43efb1fb68d96be0c12e39f 100644 (file)
@@ -50,6 +50,7 @@ struct session *session_new(struct proxy *fe, struct listener *li, enum obj_type
                vars_init(&sess->vars, SCOPE_SESS);
                sess->task = NULL;
                sess->t_handshake = -1; /* handshake not done yet */
+               sess->t_idle = -1;
                _HA_ATOMIC_ADD(&totalconn, 1);
                _HA_ATOMIC_ADD(&jobs, 1);
                LIST_INIT(&sess->srv_list);