[MEDIUM] session-counters: automatically update tracked connection count
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.
diff --git a/include/proto/session.h b/include/proto/session.h
index 0f218bb..6d5de3a 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -71,9 +71,16 @@
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));
}