[git commit] ntpd: get rid of G.initial_poll_complete
Denys Vlasenko
vda.linux at googlemail.com
Thu Jan 29 15:31:36 UTC 2015
commit: http://git.busybox.net/busybox/commit/?id=ff3f3accc68c84851d1ea8cd995f9491b32bedef
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
This speeds up syncing - now happens only just
two replies from a peer. Especially useful for "ntpd -q".
Shouldn't have ill effects: if we chose a bad peer,
we will discover it later and switch to another one.
The code is even smaller this way.
Suggested by Miroslav Lichvar <mlichvar at redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/ntpd.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 33cb1dc..c016bfc 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -376,8 +376,6 @@ struct globals {
*/
#define G_precision_sec 0.002
uint8_t stratum;
- /* Bool. After set to 1, never goes back to 0: */
- smallint initial_poll_complete;
#define STATE_NSET 0 /* initial state, "nothing is set" */
//#define STATE_FSET 1 /* frequency set from file */
@@ -1084,7 +1082,7 @@ select_and_cluster(void)
num_points = 0;
item = G.ntp_peers;
- if (G.initial_poll_complete) while (item != NULL) {
+ while (item != NULL) {
double rd, offset;
p = (peer_t *) item->data;
@@ -1649,7 +1647,7 @@ update_local_clock(peer_t *p)
if (G.ntp_status & LI_MINUSSEC)
tmx.status |= STA_DEL;
- tmx.constant = G.poll_exp - 4;
+ tmx.constant = (int)G.poll_exp - 4 > 0 ? (int)G.poll_exp - 4 : 0;
/* EXPERIMENTAL.
* The below if statement should be unnecessary, but...
* It looks like Linux kernel's PLL is far too gentle in changing
@@ -2285,7 +2283,6 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
VERB4 bb_error_msg("disabling burst mode");
G.polladj_count = 0;
G.poll_exp = MINPOLL;
- G.initial_poll_complete = 1;
}
send_query_to_peer(p);
} else {
More information about the busybox-cvs
mailing list