Commit a990f526 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make update_hello_interval indicate if anything changed.

parent b739cbc2
......@@ -735,18 +735,35 @@ network_idle(struct network *net)
net->activity_time < now.tv_sec - idle_time);
}
void
int
update_hello_interval(struct network *net)
{
if(network_idle(net))
net->hello_interval = idle_hello_interval;
else if(net->wired)
net->hello_interval = wired_hello_interval;
else
net->hello_interval = wireless_hello_interval;
int rc = 0;
if(network_idle(net)) {
if(net->hello_interval != idle_hello_interval) {
net->hello_interval = idle_hello_interval;
rc = 1;
}
} else if(net->wired) {
if(net->hello_interval != wired_hello_interval) {
net->hello_interval = wired_hello_interval;
rc = 1;
}
} else {
if(net->hello_interval != wireless_hello_interval) {
net->hello_interval = wireless_hello_interval;
rc = 1;
}
}
if(net->ihu_interval != 3 * net->hello_interval) {
net->ihu_interval = 3 * net->hello_interval;
rc = 1;
}
net->self_update_interval =
MAX(15 + net->hello_interval / 2, net->hello_interval);
net->ihu_interval = 10 * net->hello_interval / 4;
return rc;
}
......@@ -99,4 +99,4 @@ extern int kernel_socket;
extern int max_request_hopcount;
int network_idle(struct network *net);
void update_hello_interval(struct network *net);
int update_hello_interval(struct network *net);
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