From ed55ff878d5af35dae70f78023ab2141d36e5866 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 15 Nov 2024 15:44:05 +0100 Subject: [PATCH] BUG/MINOR: peers: make sure to always apply offsets to now_ms in expiration 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peers.c b/src/peers.c index 5094002b1..c17e6ecd5 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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); } }