From 863866354d058554e691959870770a8a07350431 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 14 Mar 2024 15:37:15 +0100 Subject: [PATCH] ntp: avoid unnecessary restart of resolving round on refresh Don't call NSR_ResolveSources() when a resolving round is already started. This cuts the number of calls of the system resolver made due to the refresh command to half. --- ntp_sources.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ntp_sources.c b/ntp_sources.c index 1257f57..64d9a8b 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -1056,7 +1056,10 @@ resolve_source_replacement(SourceRecord *record, int refreshment) us->address = *record->remote_addr; append_unresolved_source(us); - NSR_ResolveSources(); + + /* Don't restart resolving round if already running */ + if (!resolving_source) + NSR_ResolveSources(); } /* ================================================== */