ntp: don't adjust polling interval when sending fails
This commit is contained in:
parent
e3c77f9b4b
commit
d446950c6a
1 changed files with 15 additions and 12 deletions
27
ntp_core.c
27
ntp_core.c
|
@ -805,6 +805,7 @@ static void
|
||||||
transmit_timeout(void *arg)
|
transmit_timeout(void *arg)
|
||||||
{
|
{
|
||||||
NCR_Instance inst = (NCR_Instance) arg;
|
NCR_Instance inst = (NCR_Instance) arg;
|
||||||
|
int sent;
|
||||||
|
|
||||||
inst->timer_running = 0;
|
inst->timer_running = 0;
|
||||||
|
|
||||||
|
@ -860,16 +861,26 @@ transmit_timeout(void *arg)
|
||||||
|
|
||||||
inst->presend_done = 0; /* Reset for next time */
|
inst->presend_done = 0; /* Reset for next time */
|
||||||
|
|
||||||
|
sent = transmit_packet(inst->mode, inst->local_poll,
|
||||||
|
NTP_VERSION,
|
||||||
|
inst->do_auth, inst->auth_key_id,
|
||||||
|
&inst->remote_orig,
|
||||||
|
&inst->local_rx, &inst->local_tx, &inst->local_ntp_tx,
|
||||||
|
&inst->remote_addr,
|
||||||
|
&inst->local_addr);
|
||||||
|
|
||||||
++inst->tx_count;
|
++inst->tx_count;
|
||||||
|
|
||||||
/* If the source loses connectivity, back off the sampling rate to reduce
|
/* If the source loses connectivity and our packets are still being sent,
|
||||||
wasted sampling. If it's the source to which we are currently locked,
|
back off the sampling rate to reduce the network traffic. If it's the
|
||||||
back off slower. */
|
source to which we are currently locked, back off slowly. */
|
||||||
|
|
||||||
if (inst->tx_count >= 2) {
|
if (inst->tx_count >= 2) {
|
||||||
/* Implies we have missed at least one transmission */
|
/* Implies we have missed at least one transmission */
|
||||||
|
|
||||||
adjust_poll(inst, SRC_IsSyncPeer(inst->source) ? 0.1 : 0.25);
|
if (sent) {
|
||||||
|
adjust_poll(inst, SRC_IsSyncPeer(inst->source) ? 0.1 : 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
SRC_UpdateReachability(inst->source, 0);
|
SRC_UpdateReachability(inst->source, 0);
|
||||||
|
|
||||||
|
@ -878,14 +889,6 @@ transmit_timeout(void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transmit_packet(inst->mode, inst->local_poll,
|
|
||||||
NTP_VERSION,
|
|
||||||
inst->do_auth, inst->auth_key_id,
|
|
||||||
&inst->remote_orig,
|
|
||||||
&inst->local_rx, &inst->local_tx, &inst->local_ntp_tx,
|
|
||||||
&inst->remote_addr,
|
|
||||||
&inst->local_addr);
|
|
||||||
|
|
||||||
switch (inst->opmode) {
|
switch (inst->opmode) {
|
||||||
case MD_BURST_WAS_ONLINE:
|
case MD_BURST_WAS_ONLINE:
|
||||||
case MD_BURST_WAS_OFFLINE:
|
case MD_BURST_WAS_OFFLINE:
|
||||||
|
|
Loading…
Reference in a new issue