Stop burst sampling when received KoD RATE
This commit is contained in:
parent
e0009f9f40
commit
f0fd7099c0
1 changed files with 18 additions and 9 deletions
27
ntp_core.c
27
ntp_core.c
|
@ -1110,6 +1110,24 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
|
|||
|
||||
}
|
||||
|
||||
/* Reduce polling rate if KoD RATE was received */
|
||||
if (kod_rate && valid_kod) {
|
||||
if (inst->remote_poll > inst->minpoll) {
|
||||
inst->minpoll = inst->remote_poll;
|
||||
if (inst->minpoll > inst->maxpoll)
|
||||
inst->maxpoll = inst->minpoll;
|
||||
if (inst->minpoll > inst->local_poll)
|
||||
inst->local_poll = inst->minpoll;
|
||||
LOG(LOGS_WARN, LOGF_NtpCore, "Received KoD RATE from %s, minpoll set to %d", UTI_IPToString(&inst->remote_addr.ip_addr), inst->minpoll);
|
||||
}
|
||||
|
||||
/* Stop ongoing burst */
|
||||
if (inst->opmode == MD_BURST_WAS_OFFLINE || inst->opmode == MD_BURST_WAS_ONLINE) {
|
||||
inst->burst_good_samples_to_go = 0;
|
||||
LOG(LOGS_WARN, LOGF_NtpCore, "Received KoD RATE from %s, burst sampling stopped", UTI_IPToString(&inst->remote_addr.ip_addr), inst->minpoll);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're in burst mode, check whether the burst is completed and
|
||||
revert to the previous mode */
|
||||
|
||||
|
@ -1212,16 +1230,7 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
|
|||
|
||||
}
|
||||
|
||||
/* Reduce polling if KoD RATE was received */
|
||||
if (kod_rate && valid_kod) {
|
||||
if (inst->remote_poll > inst->minpoll) {
|
||||
inst->minpoll = inst->remote_poll;
|
||||
if (inst->minpoll > inst->maxpoll)
|
||||
inst->maxpoll = inst->minpoll;
|
||||
if (inst->minpoll > inst->local_poll)
|
||||
inst->local_poll = inst->minpoll;
|
||||
LOG(LOGS_INFO, LOGF_NtpCore, "Received KoD RATE from %s, minpoll set to %d", UTI_IPToString(&inst->remote_addr.ip_addr), inst->minpoll);
|
||||
}
|
||||
/* Back off for a while */
|
||||
delay_time += (double) (4 * (1UL << inst->minpoll));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue