]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: Use a dedicated reconnect timeout when stopping the local peer
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Jul 2022 17:14:36 +0000 (19:14 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 07:56:38 +0000 (09:56 +0200)
When a process is stopped or reload, a dedicated reconnect timeout is now
used. For now, this timeout is not used because the current code retries
immediately to reconnect to perform the local synchronization with the new
local peer, if any.

This patch is required to fix the issue #1799. It should be backported as
far as 2.0 with next fixes.

src/peers.c

index 41cf7d829d071a0c71b3288b15aab15b6c7e5d60..f9d8077ff22a98eaa3cc76cfb1f090cce902b647 100644 (file)
 
 #define PEER_RESYNC_TIMEOUT         5000 /* 5 seconds */
 #define PEER_RECONNECT_TIMEOUT      5000 /* 5 seconds */
+#define PEER_LOCAL_RECONNECT_TIMEOUT 500 /* 500ms */
 #define PEER_HEARTBEAT_TIMEOUT      3000 /* 3 seconds */
 
 /* flags for "show peers" */
@@ -3200,7 +3201,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        int idx;
 
        peer->new_conn++;
-       peer->reconnect = tick_add(now_ms, MS_TO_TICKS(PEER_RECONNECT_TIMEOUT));
+       peer->reconnect = tick_add(now_ms, (stopping ? MS_TO_TICKS(PEER_LOCAL_RECONNECT_TIMEOUT) : MS_TO_TICKS(PEER_RECONNECT_TIMEOUT)));
        peer->heartbeat = TICK_ETERNITY;
        peer->statuscode = PEER_SESS_SC_CONNECTCODE;
        peer->last_hdshk = now_ms;