ntp: don't adjust polling interval when sending fails

This commit is contained in:
Miroslav Lichvar 2014-08-20 15:24:21 +02:00
parent e3c77f9b4b
commit d446950c6a

View file

@ -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 */
if (sent) {
adjust_poll(inst, SRC_IsSyncPeer(inst->source) ? 0.1 : 0.25); 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: