MINOR: session: Add the idle duration field into the session
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.
diff --git a/include/haproxy/session-t.h b/include/haproxy/session-t.h
index 3bb753a..45b820c 100644
--- a/include/haproxy/session-t.h
+++ b/include/haproxy/session-t.h
@@ -54,9 +54,10 @@
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 {
diff --git a/src/session.c b/src/session.c
index 710b6b6..07828df 100644
--- a/src/session.c
+++ b/src/session.c
@@ -50,6 +50,7 @@
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);