Commit e75aa64e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement timeout_jitter.

parent ce690bff
......@@ -127,6 +127,16 @@ update_jitter(struct network *net, int urgent)
return (interval / 2 + random() % interval);
}
void
timeout_jitter(struct timeval *time, struct timeval *timeout, int msecs)
{
int delay;
delay = msecs * 3 / 2 + random() % MAX(msecs / 3, 10);
*time = now;
timeval_plus_msec(timeout, &now, delay);
}
static int
check_network_ipv4(struct network *net)
{
......
......@@ -52,5 +52,6 @@ int network_idle(struct network *net);
int update_hello_interval(struct network *net);
unsigned int jitter(struct network *net);
unsigned int update_jitter(struct network *net, int urgent);
void timeout_jitter(struct timeval *time, struct timeval *timeout, int msecs);
int network_up(struct network *net, int up);
void check_networks(void);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment