Reselect source also according to distance
Reselect when a source with the same stratum is available and has significantly better distance than the current source.
This commit is contained in:
parent
8cd9e68246
commit
352f03d487
1 changed files with 17 additions and 14 deletions
27
sources.c
27
sources.c
|
@ -656,18 +656,7 @@ SRC_SelectSource(unsigned long match_addr)
|
||||||
if (stratum < min_stratum) min_stratum = stratum;
|
if (stratum < min_stratum) min_stratum = stratum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
/* Find the best source with minimum stratum */
|
||||||
LOG(LOGS_INFO, LOGF_Sources, "min_stratum=%d", min_stratum);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Does the current source have this stratum and is it still a
|
|
||||||
survivor? */
|
|
||||||
|
|
||||||
if ((selected_source_index == INVALID_SOURCE) ||
|
|
||||||
(sources[selected_source_index]->status != SRC_SELECTABLE) ||
|
|
||||||
(sources[selected_source_index]->sel_info.stratum > min_stratum)) {
|
|
||||||
|
|
||||||
/* We have to elect a new synchronisation source */
|
|
||||||
min_distance_index = INVALID_SOURCE;
|
min_distance_index = INVALID_SOURCE;
|
||||||
for (i=0; i<n_sel_sources; i++) {
|
for (i=0; i<n_sel_sources; i++) {
|
||||||
index = sel_sources[i];
|
index = sel_sources[i];
|
||||||
|
@ -680,6 +669,20 @@ SRC_SelectSource(unsigned long match_addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
LOG(LOGS_INFO, LOGF_Sources, "min_stratum=%d", min_stratum);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Does the current source have this stratum, doesn't have distance
|
||||||
|
much worse than the best source and is it still a survivor? */
|
||||||
|
|
||||||
|
if ((selected_source_index == INVALID_SOURCE) ||
|
||||||
|
(sources[selected_source_index]->status != SRC_SELECTABLE) ||
|
||||||
|
(sources[selected_source_index]->sel_info.stratum > min_stratum) ||
|
||||||
|
(sources[selected_source_index]->sel_info.root_distance > 10 * min_distance)) {
|
||||||
|
|
||||||
|
/* We have to elect a new synchronisation source */
|
||||||
|
|
||||||
selected_source_index = min_distance_index;
|
selected_source_index = min_distance_index;
|
||||||
LOG(LOGS_INFO, LOGF_Sources, "Selected source %s",
|
LOG(LOGS_INFO, LOGF_Sources, "Selected source %s",
|
||||||
source_to_string(sources[selected_source_index]));
|
source_to_string(sources[selected_source_index]));
|
||||||
|
|
Loading…
Reference in a new issue