mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 11:25:07 -05:00
ntp: add burst option
When the burst option is specified in the server/pool directive and the current poll is longer than the minimum poll, initiate on each poll a burst with 1 good sample and 2 or 4 total samples according to the difference between the current and minimum poll.
This commit is contained in:
14
ntp_core.c
14
ntp_core.c
@@ -88,6 +88,7 @@ struct NCR_Instance_Record {
|
||||
SCH_TimeoutID tx_timeout_id; /* Timeout ID for next transmission */
|
||||
int tx_suspended; /* Boolean indicating we can't transmit yet */
|
||||
|
||||
int auto_burst; /* If 1, initiate a burst on each poll */
|
||||
int auto_offline; /* If 1, automatically go offline if server/peer
|
||||
isn't responding */
|
||||
|
||||
@@ -236,6 +237,10 @@ static ARR_Instance broadcasts;
|
||||
#define IBURST_GOOD_SAMPLES 4
|
||||
#define IBURST_TOTAL_SAMPLES SOURCE_REACH_BITS
|
||||
|
||||
/* Number of samples in automatic burst */
|
||||
#define BURST_GOOD_SAMPLES 1
|
||||
#define MAX_BURST_TOTAL_SAMPLES 4
|
||||
|
||||
/* Time to wait after sending packet to 'warm up' link */
|
||||
#define WARM_UP_DELAY 2.0
|
||||
|
||||
@@ -557,6 +562,7 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar
|
||||
result->max_delay_ratio = CLAMP(0.0, params->max_delay_ratio, MAX_MAXDELAYRATIO);
|
||||
result->max_delay_dev_ratio = CLAMP(0.0, params->max_delay_dev_ratio, MAX_MAXDELAYDEVRATIO);
|
||||
result->offset_correction = params->offset;
|
||||
result->auto_burst = params->burst;
|
||||
result->auto_offline = params->auto_offline;
|
||||
result->poll_target = params->poll_target;
|
||||
|
||||
@@ -1121,6 +1127,14 @@ transmit_timeout(void *arg)
|
||||
if (inst->burst_total_samples_to_go <= 0)
|
||||
take_offline(inst);
|
||||
break;
|
||||
case MD_ONLINE:
|
||||
/* Start a new burst if the burst option is enabled and the average
|
||||
polling interval including the burst will not fall below the
|
||||
minimum polling interval */
|
||||
if (inst->auto_burst && inst->local_poll > inst->minpoll && inst->local_poll > 1)
|
||||
NCR_InitiateSampleBurst(inst, BURST_GOOD_SAMPLES,
|
||||
MIN(1 << (inst->local_poll - inst->minpoll),
|
||||
MAX_BURST_TOTAL_SAMPLES));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user