Commit 917e8722 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Maintaine update_flush_timeout per-interface.

parent 51e4a64e
......@@ -538,8 +538,8 @@ main(int argc, char **argv)
timeval_min(&tv, &net->hello_timeout);
timeval_min(&tv, &net->self_update_timeout);
timeval_min(&tv, &net->update_timeout);
timeval_min(&tv, &net->update_flush_timeout);
}
timeval_min(&tv, &update_flush_timeout);
timeval_min(&tv, &unicast_flush_timeout);
FD_ZERO(&readfds);
if(timeval_compare(&tv, &now) > 0) {
......@@ -688,6 +688,8 @@ main(int argc, char **argv)
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_flush_timeout) >= 0)
flushupdates(net);
}
if(resend_time.tv_sec != 0) {
......@@ -695,11 +697,6 @@ main(int argc, char **argv)
do_resend();
}
if(update_flush_timeout.tv_sec != 0) {
if(timeval_compare(&now, &update_flush_timeout) >= 0)
flushupdates(NULL);
}
if(unicast_flush_timeout.tv_sec != 0) {
if(timeval_compare(&now, &unicast_flush_timeout) >= 0)
flush_unicast(1);
......
......@@ -40,8 +40,6 @@ THE SOFTWARE.
#include "filter.h"
#include "kernel.h"
struct timeval update_flush_timeout = {0, 0};
unsigned char packet_header[4] = {42, 2};
int parasitic = 0;
......@@ -917,8 +915,8 @@ flushupdates(struct network *net)
done:
free(b);
}
update_flush_timeout.tv_sec = 0;
update_flush_timeout.tv_usec = 0;
net->update_flush_timeout.tv_sec = 0;
net->update_flush_timeout.tv_usec = 0;
}
static void
......@@ -926,11 +924,12 @@ schedule_update_flush(struct network *net, int urgent)
{
unsigned msecs;
msecs = update_jitter(net, urgent);
if(update_flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&update_flush_timeout, &now) < msecs)
if(net->update_flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&net->update_flush_timeout, &now) < msecs)
return;
update_flush_timeout.tv_usec = (now.tv_usec + msecs * 1000) % 1000000;
update_flush_timeout.tv_sec =
net->update_flush_timeout.tv_usec =
(now.tv_usec + msecs * 1000) % 1000000;
net->update_flush_timeout.tv_sec =
now.tv_sec + (now.tv_usec / 1000 + msecs) / 1000;
}
......
......@@ -47,7 +47,6 @@ extern int silent_time;
extern int broadcast_ihu;
extern int split_horizon;
extern struct timeval update_flush_timeout;
extern unsigned char packet_header[4];
extern struct neighbour *unicast_neighbour;
......
......@@ -36,12 +36,13 @@ struct network {
struct timeval hello_timeout;
struct timeval self_update_timeout;
struct timeval update_timeout;
struct timeval flush_timeout;
struct timeval update_flush_timeout;
char ifname[IF_NAMESIZE];
unsigned char *ipv4;
int numll;
unsigned char (*ll)[16];
int buffered;
struct timeval flush_timeout;
int bufsize;
char have_buffered_hello;
char have_buffered_id;
......
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