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

Simplify handling of idle networks.

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