]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: make burst interval proportional to polling interval
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 21 Jun 2018 14:46:30 +0000 (16:46 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 22 Jun 2018 08:57:03 +0000 (10:57 +0200)
If the polling interval is shorter than 8 seconds, set the burst
interval to the 1/4th of the polling interval instead of the 2-second
constant. This should make the burst option and command useful with
very short polling intervals.

ntp_core.c

index a4dd926b93f8a3d189106aa549f617a81dfd4996..1c449f623fdd9dee62a4133f9201c536b96a0a90 100644 (file)
@@ -226,12 +226,10 @@ static ARR_Instance broadcasts;
 /* Adjustment of the peer polling interval */
 #define PEER_SAMPLING_ADJ 1.1
 
-/* Spacing between samples in burst mode for one server/peer */
-#define BURST_INTERVAL 2.0
-
-/* Time to wait before retransmitting in burst mode, if we did not get
-   a reply to the previous probe */
-#define BURST_TIMEOUT 2.0
+/* Maximum spacing between samples in the burst mode as an absolute
+   value and ratio to the normal polling interval */
+#define MAX_BURST_INTERVAL 2.0
+#define MAX_BURST_POLL_RATIO 0.25
 
 /* Number of samples in initial burst */
 #define IBURST_GOOD_SAMPLES 4
@@ -852,7 +850,7 @@ get_transmit_delay(NCR_Instance inst, int on_tx, double last_tx)
     case MD_BURST_WAS_ONLINE:
     case MD_BURST_WAS_OFFLINE:
       /* Burst modes */
-      delay_time = on_tx ? BURST_TIMEOUT : BURST_INTERVAL;
+      delay_time = MIN(MAX_BURST_INTERVAL, MAX_BURST_POLL_RATIO * delay_time);
       break;
     default:
       assert(0);