mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 10:15:07 -05:00
ntp: don't replace source instance when changing address
Add new functions to change source's reference ID/address and reset the instance. Use that instead of destroying and creating a new instance when the NTP address is changed.
This commit is contained in:
@@ -182,9 +182,8 @@ SST_CreateInstance(uint32_t refid, IPAddr *addr)
|
||||
{
|
||||
SST_Stats inst;
|
||||
inst = MallocNew(struct SST_Stats_Record);
|
||||
inst->refid = refid;
|
||||
inst->ip_addr = addr;
|
||||
|
||||
SST_SetRefid(inst, refid, addr);
|
||||
SST_ResetInstance(inst);
|
||||
|
||||
return inst;
|
||||
@@ -220,6 +219,15 @@ SST_ResetInstance(SST_Stats inst)
|
||||
inst->nruns = 0;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
SST_SetRefid(SST_Stats inst, uint32_t refid, IPAddr *addr)
|
||||
{
|
||||
inst->refid = refid;
|
||||
inst->ip_addr = addr;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
/* This function is called to prune the register down when it is full.
|
||||
For now, just discard the oldest sample. */
|
||||
|
||||
Reference in New Issue
Block a user