mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 20:45:06 -05:00
ntp: reset TX counter on all valid responses
Also change it to an unsigned type.
This commit is contained in:
13
ntp_core.c
13
ntp_core.c
@@ -139,9 +139,8 @@ struct NCR_Instance_Record {
|
|||||||
uint32_t auth_key_id; /* The ID of the authentication key to
|
uint32_t auth_key_id; /* The ID of the authentication key to
|
||||||
use. */
|
use. */
|
||||||
|
|
||||||
/* Count of how many packets we have transmitted since last successful
|
/* Count of transmitted packets since last valid response */
|
||||||
receive from this peer */
|
unsigned int tx_count;
|
||||||
int tx_count;
|
|
||||||
|
|
||||||
/* Flag indicating a valid response was received since last request */
|
/* Flag indicating a valid response was received since last request */
|
||||||
int valid_rx;
|
int valid_rx;
|
||||||
@@ -1582,10 +1581,8 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
|||||||
inst->remote_stratum = message->stratum != NTP_INVALID_STRATUM ?
|
inst->remote_stratum = message->stratum != NTP_INVALID_STRATUM ?
|
||||||
message->stratum : NTP_MAX_STRATUM;
|
message->stratum : NTP_MAX_STRATUM;
|
||||||
|
|
||||||
if (synced_packet) {
|
inst->tx_count = 0;
|
||||||
inst->tx_count = 0;
|
SRC_UpdateReachability(inst->source, synced_packet);
|
||||||
SRC_UpdateReachability(inst->source, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (good_packet) {
|
if (good_packet) {
|
||||||
/* Do this before we accumulate a new sample into the stats registers, obviously */
|
/* Do this before we accumulate a new sample into the stats registers, obviously */
|
||||||
@@ -1625,7 +1622,7 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (synced_packet) {
|
} else {
|
||||||
/* Slowly increase the polling interval if we can't get good packet */
|
/* Slowly increase the polling interval if we can't get good packet */
|
||||||
adjust_poll(inst, 0.1);
|
adjust_poll(inst, 0.1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user