From: Miroslav Lichvar Date: Mon, 29 Apr 2024 13:42:16 +0000 (+0200) Subject: sources: update source selection with unreachable sources X-Git-Tag: 4.6-pre1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c43efccf0273;p=thirdparty%2Fchrony.git sources: update source selection with unreachable sources When updating the reachability register of a source with zero, call the source selection even if the source is not the currently selected as the best source. But do that only if all reachability bits are zero, i.e. there was no synchronized response for last 8 polls. This will enable the source selection to log a message when only unreachable sources are updating reachability and it decreases the number of unnecessary source selections. --- diff --git a/sources.c b/sources.c index b728431c..626aaa5b 100644 --- a/sources.c +++ b/sources.c @@ -524,8 +524,8 @@ SRC_UpdateReachability(SRC_Instance inst, int reachable) if (inst->reachability_size < SOURCE_REACH_BITS) inst->reachability_size++; - if (!reachable && inst->index == selected_source_index) { - /* Try to select a better source */ + /* Source selection can change with unreachable sources */ + if (inst->reachability == 0) { SRC_SelectSource(NULL); }