aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-12-07 17:29:03 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-12-07 17:29:03 +0100
commit777be10ebebb4afdaf057a5abe094c86eb6d8a2c (patch)
tree71ac6b6f7d6354c3ae464a9213aa3e44f69f866c
parent6c46eed6e935db43dedbff1d026e4cf68f0bc67e (diff)
downloadbusybox-w32-777be10ebebb4afdaf057a5abe094c86eb6d8a2c.tar.gz
busybox-w32-777be10ebebb4afdaf057a5abe094c86eb6d8a2c.tar.bz2
busybox-w32-777be10ebebb4afdaf057a5abe094c86eb6d8a2c.zip
ntpd: do not invalidate datapoints after step
Used to set p->filter_datapoint[i].d_dispersion = MAXDISP and clear reachable bits, but this proved to be too agressive: after step (tested with suspinding laptop for ~30 secs), this caused all previous data to be considered invalid, making us needing to collect full ~8 datapoins per peer after step in order to start trusting them. In turn, this was making poll interval decrease even after step was done. (Poll interval decreases already before step in this scenario, because we see large offsets and end up with no good peer to select). function old new delta reset_peer_stats 157 139 -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ntpd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index f3a4177da..fd2f24a89 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -678,6 +678,18 @@ reset_peer_stats(peer_t *p, double offset)
678 int i; 678 int i;
679 bool small_ofs = fabs(offset) < 16 * STEP_THRESHOLD; 679 bool small_ofs = fabs(offset) < 16 * STEP_THRESHOLD;
680 680
681 /* Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
682 * and clear reachable bits, but this proved to be too agressive:
683 * after step (tested with suspinding laptop for ~30 secs),
684 * this caused all previous data to be considered invalid,
685 * making us needing to collect full ~8 datapoins per peer
686 * after step in order to start trusting them.
687 * In turn, this was making poll interval decrease even after
688 * step was done. (Poll interval decreases already before step
689 * in this scenario, because we see large offsets and end up with
690 * no good peer to select).
691 */
692
681 for (i = 0; i < NUM_DATAPOINTS; i++) { 693 for (i = 0; i < NUM_DATAPOINTS; i++) {
682 if (small_ofs) { 694 if (small_ofs) {
683 p->filter_datapoint[i].d_recv_time += offset; 695 p->filter_datapoint[i].d_recv_time += offset;
@@ -691,13 +703,13 @@ reset_peer_stats(peer_t *p, double offset)
691 } else { 703 } else {
692 p->filter_datapoint[i].d_recv_time = G.cur_time; 704 p->filter_datapoint[i].d_recv_time = G.cur_time;
693 p->filter_datapoint[i].d_offset = 0; 705 p->filter_datapoint[i].d_offset = 0;
694 p->filter_datapoint[i].d_dispersion = MAXDISP; 706 /*p->filter_datapoint[i].d_dispersion = MAXDISP;*/
695 } 707 }
696 } 708 }
697 if (small_ofs) { 709 if (small_ofs) {
698 p->lastpkt_recv_time += offset; 710 p->lastpkt_recv_time += offset;
699 } else { 711 } else {
700 p->reachable_bits = 0; 712 /*p->reachable_bits = 0;*/
701 p->lastpkt_recv_time = G.cur_time; 713 p->lastpkt_recv_time = G.cur_time;
702 } 714 }
703 filter_datapoints(p); /* recalc p->filter_xxx */ 715 filter_datapoints(p); /* recalc p->filter_xxx */