Commit 70066514 authored by Julien Cristau's avatar Julien Cristau

Send txcosts more often.

parent ffc0d48e
...@@ -419,10 +419,10 @@ main(int argc, char **argv) ...@@ -419,10 +419,10 @@ 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) { if(now.tv_sec >= nets[i].update_time + update_interval)
send_update(NULL, &nets[i]); send_update(NULL, &nets[i]);
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(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]); send_self_update(&nets[i]);
...@@ -577,7 +577,7 @@ add_network(char *ifname, int ifindex, int mtu, ...@@ -577,7 +577,7 @@ add_network(char *ifname, int ifindex, int mtu,
nets[numnets].hello_interval = hello_interval; nets[numnets].hello_interval = hello_interval;
nets[numnets].self_update_interval = nets[numnets].self_update_interval =
MAX(15 + hello_interval / 2 , hello_interval); MAX(15 + hello_interval / 2 , hello_interval);
nets[numnets].txcost_interval = MIN(42, 2 * hello_interval);
nets[numnets].bufsize = mtu - sizeof(packet_header); nets[numnets].bufsize = mtu - sizeof(packet_header);
strncpy(nets[numnets].ifname, ifname, IF_NAMESIZE); strncpy(nets[numnets].ifname, ifname, IF_NAMESIZE);
p = malloc(nets[numnets].bufsize); p = malloc(nets[numnets].bufsize);
......
...@@ -64,6 +64,7 @@ struct network { ...@@ -64,6 +64,7 @@ struct network {
int hello_time; int hello_time;
int self_update_time; int self_update_time;
int update_time; int update_time;
int txcost_time;
char ifname[IF_NAMESIZE]; char ifname[IF_NAMESIZE];
int buffered; int buffered;
struct timeval flush_time; struct timeval flush_time;
...@@ -72,6 +73,7 @@ struct network { ...@@ -72,6 +73,7 @@ struct network {
unsigned char hello_seqno; unsigned char hello_seqno;
unsigned int hello_interval; unsigned int hello_interval;
unsigned int self_update_interval; unsigned int self_update_interval;
unsigned int txcost_interval;
}; };
extern struct timeval now; extern struct timeval now;
......
...@@ -544,6 +544,7 @@ send_txcost(struct neighbour *neigh, struct network *net) ...@@ -544,6 +544,7 @@ send_txcost(struct neighbour *neigh, struct network *net)
} }
} }
} }
net->txcost_time = now.tv_sec;
} else { } else {
int cost; int cost;
......
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