ntp: reverse poll tracking in interleaved symmetric mode
Unlike in the basic mode, the peer with a higher stratum needs to wait for a response before sending the next request in order to minimize the delay of the measurement and error in the measured delay. Slightly increase the delay adjustment to make it work with older chrony versions.
This commit is contained in:
parent
577290c5bc
commit
4a24368763
1 changed files with 10 additions and 7 deletions
17
ntp_core.c
17
ntp_core.c
|
@ -213,7 +213,7 @@ static ARR_Instance broadcasts;
|
||||||
#define SAMPLING_RANDOMNESS 0.02
|
#define SAMPLING_RANDOMNESS 0.02
|
||||||
|
|
||||||
/* Adjustment of the peer polling interval */
|
/* Adjustment of the peer polling interval */
|
||||||
#define PEER_SAMPLING_ADJ 1.1
|
#define PEER_SAMPLING_ADJ 1.15
|
||||||
|
|
||||||
/* Spacing between samples in burst mode for one server/peer */
|
/* Spacing between samples in burst mode for one server/peer */
|
||||||
#define BURST_INTERVAL 2.0
|
#define BURST_INTERVAL 2.0
|
||||||
|
@ -789,13 +789,16 @@ get_transmit_delay(NCR_Instance inst, int on_tx, double last_tx)
|
||||||
|
|
||||||
delay_time = UTI_Log2ToDouble(poll_to_use);
|
delay_time = UTI_Log2ToDouble(poll_to_use);
|
||||||
|
|
||||||
/* If the remote stratum is higher than ours, try to lock on the
|
/* If in the basic mode the remote stratum is higher than ours,
|
||||||
peer's polling to minimize our response time by slightly extending
|
or in the interleaved mode it is lower, wait a bit for the next
|
||||||
our delay or waiting for the peer to catch up with us as the
|
packet before responding in order to minimize the delay of the
|
||||||
random part in the actual interval is reduced. If the remote
|
measurement and its error for the peer which has higher stratum.
|
||||||
stratum is equal to ours, try to interleave evenly with the peer. */
|
If the remote stratum is equal to ours, try to interleave packets
|
||||||
|
evenly with the peer. */
|
||||||
stratum_diff = inst->remote_stratum - REF_GetOurStratum();
|
stratum_diff = inst->remote_stratum - REF_GetOurStratum();
|
||||||
if ((stratum_diff > 0 && last_tx * PEER_SAMPLING_ADJ < delay_time) ||
|
if ((((stratum_diff > 0 && !inst->interleaved) ||
|
||||||
|
(stratum_diff < 0 && inst->interleaved)) &&
|
||||||
|
last_tx * PEER_SAMPLING_ADJ < delay_time) ||
|
||||||
(!on_tx && !stratum_diff &&
|
(!on_tx && !stratum_diff &&
|
||||||
last_tx / delay_time > PEER_SAMPLING_ADJ - 0.5))
|
last_tx / delay_time > PEER_SAMPLING_ADJ - 0.5))
|
||||||
delay_time *= PEER_SAMPLING_ADJ;
|
delay_time *= PEER_SAMPLING_ADJ;
|
||||||
|
|
Loading…
Reference in a new issue