summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-02 01:50:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-02 01:50:16 +0100
commit2e36eb8f273f4542a473b71a1a5c399d729acf54 (patch)
treedd69cc61daf2e1fa425b78d2f33f358d38f27f39
parentd9109e3b48d2eb2eebcc433bfa4d04a653a93d9b (diff)
ntpd: speed up reaction to poll interval decrease
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ntpd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 5cad738c6..cabfb795a 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1484,7 +1484,20 @@ recv_and_process_peer_pkt(peer_t *p)
if (G.polladj_count < -POLLADJ_LIMIT) {
G.polladj_count = 0;
if (G.poll_exp > MINPOLL) {
+ llist_t *item;
+
G.poll_exp--;
+ /* Correct p->next_action_time in each peer
+ * which waits for sending, so that they send earlier.
+ * Old pp->next_action_time are on the order
+ * of t + (1 << old_poll_exp) + small_random,
+ * we simply need to subtract ~half of that.
+ */
+ for (item = G.ntp_peers; item != NULL; item = item->link) {
+ peer_t *pp = (peer_t *) item->data;
+ if (pp->p_fd < 0)
+ pp->next_action_time -= (1 << G.poll_exp);
+ }
VERB3 bb_error_msg("polladj: discipline_jitter:%f --poll_exp=%d",
G.discipline_jitter, G.poll_exp);
}