diff --git a/doc/chronyc.adoc b/doc/chronyc.adoc index 8c5668a..1a843c3 100644 --- a/doc/chronyc.adoc +++ b/doc/chronyc.adoc @@ -459,8 +459,8 @@ states are reported. The following states indicate the source is not considered selectable for synchronisation: * _N_ - has the *noselect* option. -* _s_ - is not synchronised. * _M_ - does not have enough measurements. +* _s_ - is not synchronised. * _d_ - has a root distance larger than the maximum distance (configured by the <> directive). * _~_ - has a jitter larger than the maximum jitter (configured by the diff --git a/sources.c b/sources.c index e7ec4b8..b728431 100644 --- a/sources.c +++ b/sources.c @@ -68,8 +68,8 @@ struct SelectInfo { typedef enum { SRC_OK, /* OK so far, not a final status! */ SRC_UNSELECTABLE, /* Has noselect option set */ - SRC_UNSYNCHRONISED, /* Provides samples but not unsynchronised */ SRC_BAD_STATS, /* Doesn't have valid stats data */ + SRC_UNSYNCHRONISED, /* Provides samples, but not synchronised */ SRC_BAD_DISTANCE, /* Has root distance longer than allowed maximum */ SRC_JITTERY, /* Had std dev larger than allowed maximum */ SRC_WAITS_STATS, /* Others have bad stats, selection postponed */ @@ -913,12 +913,6 @@ SRC_SelectSource(SRC_Instance updated_inst) continue; } - /* Ignore sources which are not synchronised */ - if (sources[i]->leap == LEAP_Unsynchronised) { - mark_source(sources[i], SRC_UNSYNCHRONISED); - continue; - } - si = &sources[i]->sel_info; SST_GetSelectionData(sources[i]->stats, &now, &si->lo_limit, &si->hi_limit, &si->root_distance, @@ -933,6 +927,12 @@ SRC_SelectSource(SRC_Instance updated_inst) continue; } + /* Ignore sources which are not synchronised */ + if (sources[i]->leap == LEAP_Unsynchronised) { + mark_source(sources[i], SRC_UNSYNCHRONISED); + continue; + } + /* Include extra dispersion in the root distance of sources that don't have new samples (the last sample is older than span of all samples) */ if (first_sample_ago < 2.0 * si->last_sample_ago) { @@ -1796,10 +1796,10 @@ get_status_char(SRC_Status status) switch (status) { case SRC_UNSELECTABLE: return 'N'; - case SRC_UNSYNCHRONISED: - return 's'; case SRC_BAD_STATS: return 'M'; + case SRC_UNSYNCHRONISED: + return 's'; case SRC_BAD_DISTANCE: return 'd'; case SRC_JITTERY: diff --git a/test/system/007-cmdmon b/test/system/007-cmdmon index 953b4f3..954a15b 100755 --- a/test/system/007-cmdmon +++ b/test/system/007-cmdmon @@ -107,7 +107,7 @@ Total HW RX : 0$" || test_fail run_chronyc "selectdata" || test_fail check_chronyc_output "^S Name/IP Address Auth COpts EOpts Last Score Interval Leap ======================================================================= -s 127\.0\.0\.1 N -PTR- -PTR- 0 1\.0 \+0ns \+0ns \?$" || test_fail +M 127\.0\.0\.1 N -PTR- -PTR- 0 1\.0 \+0ns \+0ns \?$" || test_fail run_chronyc "serverstats" || test_fail check_chronyc_output "^NTP packets received : [0-9]+