BUG/MINOR: peers: Wrong "new_conn" value for "show peers" CLI command.
This counter could be hugely incremented by the peer task responsible of managing
peer synchronizations and reconnections, for instance when a peer is not reachable
there is a period where the appctx is not created. If we receive stick-table
updates before the peer session (appctx) is instantiated, we reach the code
responsible of incrementing the "new_conn" counter.
With this patch we increment this counter only when we really instantiate a new
peer session thanks to peer_session_create().
May be backported as far as 2.0.
(cherry picked from commit 2b0ba54ddb7d555bd0116eb8278b37ac409e7779)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 219587fa3d671e6644d137d31e5a1550fa34d231)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f12c3608352e9135144483a5e1f09b092bb717ac)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 79fefdf1b16c2633b758dcfeff98ff7aa8839be0)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/peers.c b/src/peers.c
index eabc044..69cd9d7 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -2545,6 +2545,7 @@
struct connection *conn;
struct conn_stream *cs;
+ peer->new_conn++;
peer->reconnect = tick_add(now_ms, MS_TO_TICKS(PEER_RECONNECT_TIMEOUT));
peer->heartbeat = TICK_ETERNITY;
peer->statuscode = PEER_SESS_SC_CONNECTCODE;
@@ -2691,7 +2692,6 @@
/* reschedule task for reconnect */
task->expire = tick_first(task->expire, ps->reconnect);
- ps->new_conn++;
}
/* else do nothing */
} /* !ps->appctx */