aboutsummaryrefslogtreecommitdiff
path: root/networking/ntpd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-01 18:12:06 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-01 18:12:06 +0100
commitbfc2a32d8864eccbb0ce617ea1f9d114f581b872 (patch)
tree0b29121c748058d397f77ea121f3d2b205180906 /networking/ntpd.c
parentdd6673bac58cebfa9733b142520f17e4a4e2975c (diff)
downloadbusybox-w32-bfc2a32d8864eccbb0ce617ea1f9d114f581b872.tar.gz
busybox-w32-bfc2a32d8864eccbb0ce617ea1f9d114f581b872.tar.bz2
busybox-w32-bfc2a32d8864eccbb0ce617ea1f9d114f581b872.zip
ntpd: reduce poll interval increase rate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r--networking/ntpd.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 508e355c9..1c0063ef7 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this tarball for details.
7 * 7 *
8 * Parts of OpenNTPD clock syncronization code is replaced by 8 * Parts of OpenNTPD clock syncronization code is replaced by
9 * code which is based on ntp-4.2.6. It carries the following 9 * code which is based on ntp-4.2.6, whuch carries the following
10 * copyright notice: 10 * copyright notice:
11 * 11 *
12 *********************************************************************** 12 ***********************************************************************
@@ -39,6 +39,13 @@
39#endif 39#endif
40 40
41 41
42/* Verbosity control (max level of -dddd options accepted).
43 * max 5 is very talkative (and bloated). 2 is non-bloated,
44 * production level setting.
45 */
46#define MAX_VERBOSE 2
47
48
42#define RETRY_INTERVAL 5 /* on error, retry in N secs */ 49#define RETRY_INTERVAL 5 /* on error, retry in N secs */
43#define QUERYTIME_MAX 15 /* wait for reply up to N secs */ 50#define QUERYTIME_MAX 15 /* wait for reply up to N secs */
44 51
@@ -62,7 +69,7 @@
62 69
63/* Poll-adjust threshold. 70/* Poll-adjust threshold.
64 * When we see that offset is small enough compared to discipline jitter, 71 * When we see that offset is small enough compared to discipline jitter,
65 * we grow a counter: += poll_ext. When it goes over POLLADJ_LIMIT, 72 * we grow a counter: += MINPOLL. When it goes over POLLADJ_LIMIT,
66 * we poll_ext++. If offset isn't small, counter -= poll_ext*2, 73 * we poll_ext++. If offset isn't small, counter -= poll_ext*2,
67 * and when it goes below -POLLADJ_LIMIT, we poll_ext-- 74 * and when it goes below -POLLADJ_LIMIT, we poll_ext--
68 */ 75 */
@@ -81,19 +88,6 @@
81/* Parameter averaging constant */ 88/* Parameter averaging constant */
82#define AVG 4 89#define AVG 4
83 90
84/* Verbosity control (max level of -dddd options accepted).
85 * max 5 is very talkative (and bloated). 2 is non-bloated,
86 * production level setting.
87 */
88#define MAX_VERBOSE 2
89
90#define VERB1 if (MAX_VERBOSE && G.verbose)
91#define VERB2 if (MAX_VERBOSE >= 2 && G.verbose >= 2)
92#define VERB3 if (MAX_VERBOSE >= 3 && G.verbose >= 3)
93#define VERB4 if (MAX_VERBOSE >= 4 && G.verbose >= 4)
94#define VERB5 if (MAX_VERBOSE >= 5 && G.verbose >= 5)
95
96
97enum { 91enum {
98 NTP_VERSION = 4, 92 NTP_VERSION = 4,
99 NTP_MAXSTRATUM = 15, 93 NTP_MAXSTRATUM = 15,
@@ -270,6 +264,13 @@ struct globals {
270static const int const_IPTOS_LOWDELAY = IPTOS_LOWDELAY; 264static const int const_IPTOS_LOWDELAY = IPTOS_LOWDELAY;
271 265
272 266
267#define VERB1 if (MAX_VERBOSE && G.verbose)
268#define VERB2 if (MAX_VERBOSE >= 2 && G.verbose >= 2)
269#define VERB3 if (MAX_VERBOSE >= 3 && G.verbose >= 3)
270#define VERB4 if (MAX_VERBOSE >= 4 && G.verbose >= 4)
271#define VERB5 if (MAX_VERBOSE >= 5 && G.verbose >= 5)
272
273
273static double LOG2D(int a) 274static double LOG2D(int a)
274{ 275{
275 if (a < 0) 276 if (a < 0)
@@ -1420,7 +1421,9 @@ recv_and_process_peer_pkt(peer_t *p)
1420 ); 1421 );
1421 } 1422 }
1422 if (rc > 0 && fabs(q->filter_offset) < POLLADJ_GATE * G.discipline_jitter) { 1423 if (rc > 0 && fabs(q->filter_offset) < POLLADJ_GATE * G.discipline_jitter) {
1423 G.polladj_count += G.poll_exp; 1424 /* was += G.poll_exp but it is a bit
1425 * too optimistic for my taste at high poll_exp's */
1426 G.polladj_count += MINPOLL;
1424 if (G.polladj_count > POLLADJ_LIMIT) { 1427 if (G.polladj_count > POLLADJ_LIMIT) {
1425 G.polladj_count = 0; 1428 G.polladj_count = 0;
1426 if (G.poll_exp < MAXPOLL) { 1429 if (G.poll_exp < MAXPOLL) {