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

Don't send updates on idle networks.

parent 51adebb6
...@@ -404,9 +404,11 @@ main(int argc, char **argv) ...@@ -404,9 +404,11 @@ 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);
timeval_min_sec(&tv, nets[i].self_update_time + if(!network_idle(&nets[i])) {
nets[i].self_update_interval); timeval_min_sec(&tv, nets[i].self_update_time +
timeval_min_sec(&tv, nets[i].update_time + update_interval); nets[i].self_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);
...@@ -477,13 +479,15 @@ main(int argc, char **argv) ...@@ -477,13 +479,15 @@ 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(now.tv_sec >= if(!network_idle(&nets[i])) {
nets[i].self_update_time + nets[i].self_update_interval) { if(now.tv_sec >= nets[i].update_time + update_interval)
send_self_update(&nets[i], 0); send_update(NULL, &nets[i]);
if(now.tv_sec >=
nets[i].self_update_time + nets[i].self_update_interval) {
send_self_update(&nets[i], 0);
}
} }
} }
......
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