Commit 15940ce0 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Compute a smaller jitter when sending urgent updates.

parent 2391e74a
......@@ -785,9 +785,10 @@ jitter(struct network *net)
}
unsigned int
update_jitter(struct network *net)
update_jitter(struct network *net, int urgent)
{
unsigned interval = net->hello_interval * 1000;
if(urgent)
interval = MIN(interval, 1000);
return (interval / 2 + random() % interval);
}
......@@ -102,5 +102,5 @@ extern int max_request_hopcount;
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);
unsigned int update_jitter(struct network *net, int urgent);
......@@ -520,10 +520,10 @@ flushupdates(void)
}
static void
schedule_update_flush(struct network *net)
schedule_update_flush(struct network *net, int urgent)
{
int msecs;
msecs = update_jitter(net);
msecs = update_jitter(net, urgent);
if(update_flush_time.tv_sec != 0 &&
timeval_minus_msec(&update_flush_time, &now) < msecs)
return;
......@@ -598,7 +598,7 @@ send_update(struct network *net, int urgent,
buffer_update(net, routes[i].src->prefix, routes[i].src->plen);
net->update_time = now.tv_sec;
}
schedule_update_flush(net);
schedule_update_flush(net, urgent);
}
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