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 <janm@transactionware.com>
This commit is contained in:
Miroslav Lichvar 2022-01-26 16:00:36 +01:00
parent b61cbed689
commit 759580aa6f

View file

@ -283,6 +283,9 @@ open_io(void)
close_io(); close_io();
} }
/* Start from the first address if called again */
address_index = 0;
return 0; return 0;
} }