]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] session-counters: automatically update tracked connection count
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2010 19:03:20 +0000 (21:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Aug 2010 16:04:12 +0000 (18:04 +0200)
When a session tracks a counter, automatically increase the cumulated
connection count. This makes src_updt_conn_cnt() almost useless. In
fact it might still be used to update different tables.

include/proto/session.h

index 0f218bb35836cdcad3a21401716df91bea2281c9..6d5de3abff7dfbc62d4c0199195680625ec38a5a 100644 (file)
@@ -71,9 +71,16 @@ static inline void session_track_counters(struct session *s, struct stktable *t,
        s->tracked_table = t;
        s->tracked_counters = ts;
        if (ts) {
-               void *ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
+               void *ptr;
+
+               ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
                if (ptr)
                        stktable_data_cast(ptr, conn_cur)++;
+
+               ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CNT);
+               if (ptr)
+                       stktable_data_cast(ptr, conn_cnt)++;
+
                if (tick_isset(t->expire))
                        ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire));
        }