From 759580aa6f32fcc591ff357c12b54c22a8e03b91 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 26 Jan 2022 16:00:36 +0100 Subject: [PATCH] client: fix waitsync command to reconnect to server If chronyc waitsync was started before chronyd, it would try all addresses (Unix socket, IPv4, IPv6) and get stuck with no address, not getting any response later when chronyd was running. Reset the address index in open_io() when returning with failure to allow the next call to start with the first address again. Reported-by: Jan Mikkelsen --- client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.c b/client.c index ed551c6..f878fd1 100644 --- a/client.c +++ b/client.c @@ -283,6 +283,9 @@ open_io(void) close_io(); } + /* Start from the first address if called again */ + address_index = 0; + return 0; }