]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: consider only reachable orphans for selection
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 13 Apr 2016 09:43:36 +0000 (11:43 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 13 Apr 2016 09:43:36 +0000 (11:43 +0200)
Ignore orphan sources that are unreachable (but still have usable stats)
to have a quick and consistent source selection between orphans.

This also fixes the "Unknown local refid in orphan mode" error appearing
when a selected orphan source is removed, as the source is marked as
unreachable and the selection runs with disabled NTP instance before the
source instance is actually removed.

sources.c

index b3a2e97d430e3a3efb77db9ed96ff60c7261c412..79f72cfe2d941b65a9c487190121a21c41614a29 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -719,7 +719,7 @@ SRC_SelectSource(SRC_Instance updated_inst)
     if (si->stratum >= orphan_stratum && sources[i]->type == SRC_NTP) {
       sources[i]->status = SRC_ORPHAN;
 
-      if (si->stratum == orphan_stratum &&
+      if (si->stratum == orphan_stratum && sources[i]->reachability &&
           (orphan_source == INVALID_SOURCE ||
            sources[i]->ref_id < sources[orphan_source]->ref_id))
         orphan_source = i;