]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: reset leap voting flag earlier in selection
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 3 Aug 2020 14:13:56 +0000 (16:13 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 4 Aug 2020 10:19:52 +0000 (12:19 +0200)
Remove the leap vote from sources that get the noselect option, or
have too large distance or jitter.

sources.c

index 91d6a0866fbed40d336aa5677d1127b5bbcb7603..c17d638442900f516bbcdb303816fdf20b586131 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -793,6 +793,9 @@ SRC_SelectSource(SRC_Instance updated_inst)
   for (i = 0; i < n_sources; i++) {
     assert(sources[i]->status != SRC_OK);
 
+    /* Don't allow the source to vote on leap seconds unless it's selectable */
+    sources[i]->leap_vote = 0;
+
     /* If some sources are specified with the require option, at least one
        of them will have to be selectable in order to update the clock */
     if (sources[i]->sel_options & SRC_SELECT_REQUIRE)
@@ -842,7 +845,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
     }
 
     sources[i]->status = SRC_OK; /* For now */
-    sources[i]->leap_vote = 0;
 
     if (sources[i]->reachability && max_reach_sample_ago < first_sample_ago)
       max_reach_sample_ago = first_sample_ago;