sched: add more random bits to timeout scheduling
Extend the random value which is included in the calculation of the delay from 16 to 32 bits. This makes scheduling of NTP transmissions random to one microsecond for polling intervals up to 17.
This commit is contained in:
parent
74f581e7ab
commit
4b0ef09221
1 changed files with 2 additions and 2 deletions
4
sched.c
4
sched.c
|
@ -375,10 +375,10 @@ SCH_AddTimeoutInClass(double min_delay, double separation, double randomness,
|
|||
assert(class < SCH_NumberOfClasses);
|
||||
|
||||
if (randomness > 0.0) {
|
||||
uint16_t rnd;
|
||||
uint32_t rnd;
|
||||
|
||||
UTI_GetRandomBytes(&rnd, sizeof (rnd));
|
||||
r = rnd / (double)0xffff * randomness + 1.0;
|
||||
r = rnd * (randomness / (uint32_t)-1) + 1.0;
|
||||
min_delay *= r;
|
||||
separation *= r;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue