From e5cf006378d43e273553fe63694a15a3777f921e Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 3 Aug 2020 16:13:56 +0200 Subject: [PATCH] sources: reset leap voting flag earlier in selection Remove the leap vote from sources that get the noselect option, or have too large distance or jitter. --- sources.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources.c b/sources.c index 91d6a08..c17d638 100644 --- 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;