mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 02:05:06 -05:00
sources: keep synchronized status with unreachable/unselectable sources
Following RFC 5905, don't call REF_SetUnsynchronised() when there are no reachable or selectable sources. It's up to the client to consider the source unsynchronized when the root distance exceeds a threshold. The unsynchronized status is still set when no majority is reached.
This commit is contained in:
10
sources.c
10
sources.c
@@ -571,7 +571,7 @@ combine_sources(int n_sel_sources, struct timeval *ref_time, double *offset,
|
|||||||
void
|
void
|
||||||
SRC_SelectSource(SRC_Instance updated_inst)
|
SRC_SelectSource(SRC_Instance updated_inst)
|
||||||
{
|
{
|
||||||
int i, j, index, old_selected_index, sel_prefer;
|
int i, j, index, sel_prefer;
|
||||||
struct timeval now, ref_time;
|
struct timeval now, ref_time;
|
||||||
double src_offset, src_offset_sd, src_frequency, src_skew;
|
double src_offset, src_offset_sd, src_frequency, src_skew;
|
||||||
double src_root_delay, src_root_dispersion;
|
double src_root_delay, src_root_dispersion;
|
||||||
@@ -588,7 +588,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
|||||||
double max_score;
|
double max_score;
|
||||||
|
|
||||||
NTP_Leap leap_status = LEAP_Normal;
|
NTP_Leap leap_status = LEAP_Normal;
|
||||||
old_selected_index = selected_source_index;
|
|
||||||
|
|
||||||
if (updated_inst)
|
if (updated_inst)
|
||||||
updated_inst->updates++;
|
updated_inst->updates++;
|
||||||
@@ -598,7 +597,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
|||||||
if (selected_source_index != INVALID_SOURCE) {
|
if (selected_source_index != INVALID_SOURCE) {
|
||||||
log_selection_message("Can't synchronise: no sources", NULL);
|
log_selection_message("Can't synchronise: no sources", NULL);
|
||||||
selected_source_index = INVALID_SOURCE;
|
selected_source_index = INVALID_SOURCE;
|
||||||
REF_SetUnsynchronised();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -748,6 +746,7 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
|||||||
|
|
||||||
if (selected_source_index != INVALID_SOURCE) {
|
if (selected_source_index != INVALID_SOURCE) {
|
||||||
log_selection_message("Can't synchronise: no majority", NULL);
|
log_selection_message("Can't synchronise: no majority", NULL);
|
||||||
|
REF_SetUnsynchronised();
|
||||||
}
|
}
|
||||||
selected_source_index = INVALID_SOURCE;
|
selected_source_index = INVALID_SOURCE;
|
||||||
|
|
||||||
@@ -990,11 +989,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
|||||||
}
|
}
|
||||||
selected_source_index = INVALID_SOURCE;
|
selected_source_index = INVALID_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_source_index == INVALID_SOURCE &&
|
|
||||||
selected_source_index != old_selected_index) {
|
|
||||||
REF_SetUnsynchronised();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|||||||
Reference in New Issue
Block a user