sources: reorder unsynchronised source status
In the source selection, check for the unsynchronized leap status after
getting sourcestats data. The unsynchronized source status is supposed
to indicate an unsynchronized source that is providing samples, not a
source which doesn't have any samples.
Also, fix the comment describing the status.
Fixes: 4c29f8888c
("sources: handle unsynchronized sources in selection")
This commit is contained in:
parent
276591172e
commit
1affd03cca
3 changed files with 11 additions and 11 deletions
|
@ -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
|
||||
<<chrony.conf.adoc#maxdistance,*maxdistance*>> directive).
|
||||
* _~_ - has a jitter larger than the maximum jitter (configured by the
|
||||
|
|
18
sources.c
18
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:
|
||||
|
|
|
@ -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]+
|
||||
|
|
Loading…
Reference in a new issue