Commit 7d98e134 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify handling of idle networks.

parent 08dcff04
......@@ -516,10 +516,8 @@ main(int argc, char **argv)
continue;
timeval_min(&tv, &net->flush_timeout);
timeval_min(&tv, &net->hello_timeout);
if(!network_idle(net)) {
timeval_min(&tv, &net->self_update_timeout);
timeval_min(&tv, &net->update_timeout);
}
timeval_min(&tv, &net->self_update_timeout);
timeval_min(&tv, &net->update_timeout);
}
timeval_min(&tv, &update_flush_timeout);
timeval_min(&tv, &unicast_flush_timeout);
......@@ -666,12 +664,10 @@ main(int argc, char **argv)
continue;
if(timeval_compare(&now, &net->hello_timeout) >= 0)
send_hello(net);
if(!network_idle(net)) {
if(timeval_compare(&now, &net->update_timeout) >= 0)
send_update(net, 0, NULL, 0);
if(timeval_compare(&now, &net->self_update_timeout) >= 0)
send_self_update(net, 0);
}
if(timeval_compare(&now, &net->update_timeout) >= 0)
send_update(net, 0, NULL, 0);
if(timeval_compare(&now, &net->self_update_timeout) >= 0)
send_self_update(net, 0);
}
if(resend_time.tv_sec != 0) {
......
......@@ -995,12 +995,12 @@ send_update(struct network *net, int urgent,
buffer_update(net, prefix, plen);
}
} else {
send_self_update(net, 0);
/* Don't send full route dumps more than ten times per second */
if(net->update_time.tv_sec > 0 &&
timeval_minus_msec(&now, &net->update_time) < 100)
return;
send_self_update(net, 0);
if(!selfonly) {
if(!selfonly && !network_idle(net)) {
debugf("Sending update to %s for any.\n", net->ifname);
for(i = 0; i < numroutes; i++)
if(routes[i].installed)
......@@ -1057,13 +1057,13 @@ send_self_update(struct network *net, int force_seqno)
return;
}
debugf("Sending self update to %s.\n", net->ifname);
if(!network_idle(net)) {
debugf("Sending self update to %s.\n", net->ifname);
for(i = 0; i < numxroutes; i++)
send_update(net, 0, xroutes[i].prefix, xroutes[i].plen);
}
delay_jitter(&net->self_update_time, &net->self_update_timeout,
net->self_update_interval);
for(i = 0; i < numxroutes; i++) {
send_update(net, 0, xroutes[i].prefix, xroutes[i].plen);
}
}
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