]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: make sure to always apply offsets to now_ms in expiration
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:44:05 +0000 (15:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:44:05 +0000 (15:44 +0100)
Now_ms can be zero nowadays, so it's not suitable for direct assignment to
t->expire, as there's a risk that the timer never wakes up once assigned
(TICK_ETERNITY). Let's use tick_add(now_ms, 0) for an immediate wakeup
instead. The impact here might be a reconnect programmed upon signal
receipt at the wrapping date not having a working timeout.

This should be backported where it applies.

src/peers.c

index 5094002b1c2171b24b18a372c96f79b17ff5934f..c17e6ecd53410de353f1ef53a93986d1838126ac 100644 (file)
@@ -3609,7 +3609,7 @@ static void __process_stopping_peer_sync(struct task *task, struct peers *peers,
 
                        /* Set resync timeout for the local peer and request a immediate reconnect */
                        peers->resync_timeout = tick_add(now_ms, MS_TO_TICKS(PEER_RESYNC_TIMEOUT));
-                       peers->local->reconnect = now_ms;
+                       peers->local->reconnect = tick_add(now_ms, 0);
                }
        }