Commit ae1bb735 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use schedule_neighbours_check.

This causes a neighbours check to be rescheduled after we receive a hello
or IHU.
parent c5a42168
......@@ -512,7 +512,7 @@ main(int argc, char **argv)
kernel_link_changed = 0;
kernel_addr_changed = 0;
kernel_dump_time = now.tv_sec + 20 + random() % 20;
timeval_plus_msec(&check_neighbours_timeout, &now, 5000 + random() % 5000);
schedule_neighbours_check(5000, 1);
expiry_time = now.tv_sec + 20 + random() % 20;
source_expiry_time = now.tv_sec + 200 + random() % 200;
......@@ -640,9 +640,8 @@ main(int argc, char **argv)
if(timeval_compare(&check_neighbours_timeout, &now) < 0) {
int msecs;
msecs = check_neighbours();
msecs = MAX(msecs, 500);
timeval_plus_msec(&check_neighbours_timeout, &now,
msecs / 2 + random() % msecs);
msecs = MAX(msecs, 10);
schedule_neighbours_check(msecs, 1);
}
if(now.tv_sec >= expiry_time) {
......
......@@ -138,6 +138,8 @@ parse_packet(const unsigned char *from, struct network *net,
changed = update_neighbour(neigh, seqno, metric);
if(changed)
update_neighbour_metric(neigh);
if(metric > 0)
schedule_neighbours_check(metric * 10, 0);
} else {
neigh = find_neighbour(from, net);
if(neigh == NULL)
......@@ -154,6 +156,8 @@ parse_packet(const unsigned char *from, struct network *net,
neigh->ihu_time = now;
neigh->ihu_interval = seqno;
update_neighbour_metric(neigh);
if(seqno > 0)
schedule_neighbours_check(seqno * 10 * 3, 0);
}
} else if(type == 2) {
debugf("Received request on %s from %s (%s) for %s "
......
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