]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Fixes from Dave Mills
authorHarlan Stenn <stenn@ntp.org>
Wed, 5 Dec 2007 06:34:40 +0000 (01:34 -0500)
committerHarlan Stenn <stenn@ntp.org>
Wed, 5 Dec 2007 06:34:40 +0000 (01:34 -0500)
bk: 47564680_igxXwT4wFHbIGLtAL5kmw

ChangeLog
ntpd/ntp_loopfilter.c
ntpd/ntp_proto.c

index 0e3dc3072573f2290fa7d2484dd729f2fc7fecee..2cf27bea95fff364917348b734ec7768dc7dce12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* ntp_proto.c: sys_survivors and hpoll cleanup from Dave Mills.
+* ntp_loopfilter.c: sys_poll cleanup from Dave Mills.
 * refclock_wwv.c: maximum-likelihood digit and DSYNC fixes from Dave Mills.
 * [Bug 967] preemptable associations are lost forever on a step.
 * ntp_config.c: [CID 48] missing "else" clause.
index 5c171ccfb40cd2f6ad3fef469cd0c8fa50679b52..9090c9cc29d620f3b13b109852aa555cd26e5379 100644 (file)
@@ -326,6 +326,10 @@ local_clock(
         * than 0.5 s. 
         */
        osys_poll = sys_poll;
+       if (sys_poll < peer->minpoll)
+               sys_poll = peer->minpoll;
+       if (sys_poll > peer->maxpoll)
+               sys_poll = peer->maxpoll;
        clock_epoch += mu;
        clock_frequency = flladj = plladj = 0;
        rval = 1;
@@ -408,15 +412,10 @@ local_clock(
        } else {
 
                /*
-                * The offset is less than the step threshold. Clamp the
-                * poll update to the current peer. Calculatethe jitter
-                * as the exponentially weighted offset
+                * The offset is less than the step threshold. Calculate
+                * the jitter as the exponentially weighted offset
                 * differences.
                 */
-               if (sys_poll < peer->minpoll)
-                       sys_poll = peer->minpoll;
-               if (sys_poll > peer->maxpoll)
-                       sys_poll = peer->maxpoll;
                etemp = SQUARE(clock_jitter);
                dtemp = SQUARE(max(fabs(fp_offset - last_offset),
                    LOGTOD(sys_precision)));
index d88c2931baddaaca85b76f0690220594235d3362..e9bdbc69e8ac36a64ea4e59fa313b20cf886ef62 100644 (file)
@@ -156,6 +156,7 @@ transmit(
         * is intricate...
         */
        hpoll = peer->hpoll;
+
        /*
         * In broadcast mode the poll interval is never changed from
         * minpoll.
@@ -233,6 +234,7 @@ transmit(
                         * Here the peer is reachable. Send a burst if
                         * enabled and the peer is fit.
                         */
+                       hpoll = sys_poll;
                        if (!oreach || !(peer->flags & FLAG_PREEMPT))
                                peer->unreach = 0;
                        if (peer->flags & FLAG_BURST && peer->retry ==
@@ -246,7 +248,8 @@ transmit(
                 * poll_update() routine will clamp it to maxpoll.
                 */ 
                if (peer->unreach >= NTP_UNREACH) {
-                       if (peer->flags & FLAG_PREEMPT) {
+                       if (peer->flags & FLAG_PREEMPT &&
+                           sys_survivors >= sys_maxclock) {
                                peer_clear(peer, "TIME");
                                unpeer(peer);
                                return;
@@ -261,8 +264,8 @@ transmit(
                                        peer_clear(peer, "TIME");
                                        peer->unreach = 0;
                                }
-                               hpoll++;
 #endif /* OPENSSL */
+                               hpoll++;
                        }
                }
        } else {
@@ -1842,13 +1845,13 @@ clock_filter(
         * If the the new sample and the current sample are both valid
         * and the difference between their offsets exceeds CLOCK_SGATE
         * (3) times the jitter and the interval between them is less
-        * than twice the system poll interval, consider the new sample
+        * than twice the host poll interval, consider the new sample
         * a popcorn spike and ignore it.
         */
        if (peer->disp < sys_maxdist && peer->filter_disp[k] <
            sys_maxdist && etemp > CLOCK_SGATE * peer->jitter &&
            peer->filter_epoch[k] - peer->epoch < 2. *
-           ULOGTOD(sys_poll)) {
+           ULOGTOD(peer->hpoll)) {
 #ifdef DEBUG
                if (debug)
                        printf("clock_filter: popcorn %.6f %.6f\n",
@@ -3086,10 +3089,10 @@ peer_unfit(
        /*
         * A distance error for a remote peer occurs if the root
         * distance is greater than or equal to the distance threshold
-        * plus the increment due to one poll interval.
+        * plus the increment due to one host poll interval.
         */
        if (!(peer->flags & FLAG_REFCLOCK) && root_distance(peer) >=
-           sys_maxdist + clock_phi * ULOGTOD(sys_poll))
+           sys_maxdist + clock_phi * ULOGTOD(peer->hpoll))
                rval |= TEST11;         /* distance exceeded */
 
        /*