ntp: skip loop test if no server socket is open

If there is no socket that could receive a request from a client or
peer, we know that nothing can be synchronized to us and no loop is
possible.
This commit is contained in:
Miroslav Lichvar
2019-09-11 18:35:29 +02:00
parent 7a88e0a87b
commit 004986310d
4 changed files with 14 additions and 2 deletions

View File

@@ -1474,9 +1474,9 @@ check_sync_loop(NCR_Instance inst, NTP_Packet *message, NTP_Local_Address *local
NTP_Leap leap_status;
uint32_t our_ref_id;
/* Check if our server may be enabled, i.e. a client or peer can actually
/* Check if a server socket is open, i.e. a client or peer can actually
be synchronised to us */
if (REF_GetMode() != REF_ModeNormal)
if (!NIO_IsServerSocketOpen())
return 1;
/* Check if the source indicates that it is synchronised to our address