]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: fix waitsync command to reconnect to server
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 26 Jan 2022 15:00:36 +0000 (16:00 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 26 Jan 2022 15:11:01 +0000 (16:11 +0100)
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 <janm@transactionware.com>
client.c

index ed551c6db9a675b930073e27ead3bc45453cd5f0..f878fd1c9516bb9c9823c651af0104c2b7021bb2 100644 (file)
--- 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;
 }