Commit 520de845 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't send updates on idle networks.

parent 51adebb6
...@@ -404,10 +404,12 @@ main(int argc, char **argv) ...@@ -404,10 +404,12 @@ main(int argc, char **argv)
timeval_min(&tv, &nets[i].flush_time); timeval_min(&tv, &nets[i].flush_time);
timeval_min_sec(&tv, timeval_min_sec(&tv,
nets[i].hello_time + nets[i].hello_interval); nets[i].hello_time + nets[i].hello_interval);
if(!network_idle(&nets[i])) {
timeval_min_sec(&tv, nets[i].self_update_time + timeval_min_sec(&tv, nets[i].self_update_time +
nets[i].self_update_interval); nets[i].self_update_interval);
timeval_min_sec(&tv, nets[i].update_time + update_interval); timeval_min_sec(&tv, nets[i].update_time + update_interval);
} }
}
timeval_min(&tv, &update_flush_time); timeval_min(&tv, &update_flush_time);
FD_ZERO(&readfds); FD_ZERO(&readfds);
if(timeval_compare(&tv, &now) > 0) { if(timeval_compare(&tv, &now) > 0) {
...@@ -477,15 +479,17 @@ main(int argc, char **argv) ...@@ -477,15 +479,17 @@ main(int argc, char **argv)
for(i = 0; i < numnets; i++) { for(i = 0; i < numnets; i++) {
if(now.tv_sec >= nets[i].hello_time + nets[i].hello_interval) if(now.tv_sec >= nets[i].hello_time + nets[i].hello_interval)
send_hello(&nets[i]); send_hello(&nets[i]);
if(now.tv_sec >= nets[i].update_time + update_interval)
send_update(NULL, &nets[i]);
if(now.tv_sec >= nets[i].txcost_time + nets[i].txcost_interval) if(now.tv_sec >= nets[i].txcost_time + nets[i].txcost_interval)
send_txcost(NULL, &nets[i]); send_txcost(NULL, &nets[i]);
if(!network_idle(&nets[i])) {
if(now.tv_sec >= nets[i].update_time + update_interval)
send_update(NULL, &nets[i]);
if(now.tv_sec >= if(now.tv_sec >=
nets[i].self_update_time + nets[i].self_update_interval) { nets[i].self_update_time + nets[i].self_update_interval) {
send_self_update(&nets[i], 0); send_self_update(&nets[i], 0);
} }
} }
}
if(debug || dumping) { if(debug || dumping) {
dump_tables(stdout); dump_tables(stdout);
......
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