ip link: add VLAN support
[oweals/busybox.git] / networking / ntpd.c
index bff2c0d4cb28722f308eebaa8824b45ff134b9dc..b04391eb5f04397756eb977466b31f7be860cb51 100644 (file)
@@ -805,7 +805,7 @@ send_query_to_peer(peer_t *p)
        p->p_xmt_msg.m_xmttime.fractionl = random();
        p->p_xmttime = gettime1900d();
 
-       /* Was doing it only if sendto worked, but
+       /* Were doing it only if sendto worked, but
         * loss of sync detection needs reachable_bits updated
         * even if sending fails *locally*:
         * "network is unreachable" because cable was pulled?
@@ -818,6 +818,11 @@ send_query_to_peer(peer_t *p)
        ) {
                close(p->p_fd);
                p->p_fd = -1;
+               /*
+                * We know that we sent nothing.
+                * We can retry *soon* without fearing
+                * that we are flooding the peer.
+                */
                set_next(p, RETRY_INTERVAL);
                return;
        }
@@ -827,7 +832,7 @@ send_query_to_peer(peer_t *p)
 
 
 /* Note that there is no provision to prevent several run_scripts
- * to be done in quick succession. In fact, it happens rather often
+ * to be started in quick succession. In fact, it happens rather often
  * if initial syncronization results in a step.
  * You will see "step" and then "stratum" script runs, sometimes
  * as close as only 0.002 seconds apart.
@@ -838,6 +843,8 @@ static void run_script(const char *action, double offset)
        char *argv[3];
        char *env1, *env2, *env3, *env4;
 
+       G.last_script_run = G.cur_time;
+
        if (!G.script_name)
                return;
 
@@ -874,8 +881,6 @@ static void run_script(const char *action, double offset)
        free(env2);
        free(env3);
        free(env4);
-
-       G.last_script_run = G.cur_time;
 }
 
 static NOINLINE void
@@ -2228,7 +2233,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
                        G.polladj_count = 0;
                        G.poll_exp = MINPOLL;
                        G.stratum = MAXSTRAT;
-                       run_script("unsync", G.last_update_offset);
+                       run_script("unsync", 0.0);
  have_reachable_peer: ;
                }
        } /* while (!bb_got_signal) */