Commit f98459d5 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add network argument to flushupdates.

parent d4e2b1a8
......@@ -514,7 +514,7 @@ main(int argc, char **argv)
send_wildcard_retraction(net);
send_self_update(net, 0);
send_request(net, NULL, 0);
flushupdates();
flushupdates(net);
flushbuf(net);
}
......@@ -697,7 +697,7 @@ main(int argc, char **argv)
if(update_flush_timeout.tv_sec != 0) {
if(timeval_compare(&now, &update_flush_timeout) >= 0)
flushupdates();
flushupdates(NULL);
}
if(unicast_flush_timeout.tv_sec != 0) {
......
......@@ -455,8 +455,7 @@ flushbuf(struct network *net)
assert(net->buffered <= net->bufsize);
if(update_net == net)
flushupdates();
flushupdates(net);
if(net->buffered > 0) {
debugf(" (flushing %d buffered bytes on %s)\n",
......@@ -842,7 +841,7 @@ compare_buffered_updates(const void *av, const void *bv)
}
void
flushupdates(void)
flushupdates(struct network *network)
{
struct xroute *xroute;
struct route *route;
......@@ -850,6 +849,9 @@ flushupdates(void)
unsigned char last_plen = 0xFF;
int i;
if(network && network != update_net)
return;
if(updates > 0) {
int n = updates;
struct network *net = update_net;
......@@ -942,13 +944,12 @@ static void
buffer_update(struct network *net,
const unsigned char *prefix, unsigned char plen)
{
if(update_net && update_net != net)
flushupdates();
flushupdates(net);
update_net = net;
if(updates >= MAX_BUFFERED_UPDATES)
flushupdates();
flushupdates(net);
memcpy(buffered_updates[updates].prefix, prefix, 16);
buffered_updates[updates].plen = plen;
updates++;
......@@ -1185,8 +1186,7 @@ send_request(struct network *net,
}
/* make sure any buffered updates go out before this request. */
if(!net || update_net == net)
flushupdates();
flushupdates(net);
if(!net->up)
return;
......@@ -1215,8 +1215,7 @@ send_unicast_request(struct neighbour *neigh,
int rc, v4, len;
/* make sure any buffered updates go out before this request. */
if(update_net == neigh->network)
flushupdates();
flushupdates(neigh->network);
debugf("sending unicast request to %s for %s.\n",
format_address(neigh->address),
......@@ -1246,8 +1245,7 @@ send_multihop_request(struct network *net,
int v4, pb, len;
/* Make sure any buffered updates go out before this request. */
if(!net || update_net == net)
flushupdates();
flushupdates(net);
if(net == NULL) {
struct network *n;
......@@ -1293,8 +1291,7 @@ send_unicast_multihop_request(struct neighbour *neigh,
int rc, v4, pb, len;
/* Make sure any buffered updates go out before this request. */
if(update_net == neigh->network)
flushupdates();
flushupdates(neigh->network);
debugf("Sending multi-hop request to %s for %s (%d hops).\n",
format_address(neigh->address),
......
......@@ -56,7 +56,7 @@ extern struct timeval unicast_flush_timeout;
void parse_packet(const unsigned char *from, struct network *net,
const unsigned char *packet, int packetlen);
void flushbuf(struct network *net);
void flushupdates(void);
void flushupdates(struct network *network);
void send_ack(struct neighbour *neigh, unsigned short nonce,
unsigned short interval);
void send_hello_noupdate(struct network *net, unsigned interval);
......
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