Commit cee445be authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make the interface to schedule_neighbours_check less confusing.

parent 854aa4ee
......@@ -674,7 +674,8 @@ main(int argc, char **argv)
if(timeval_compare(&check_neighbours_timeout, &now) < 0) {
int msecs;
msecs = check_neighbours();
msecs = MAX(msecs, 10);
/* Multiply by 3/2 to allow neighbours to expire. */
msecs = MAX(3 * msecs / 2, 10);
schedule_neighbours_check(msecs, 1);
}
......@@ -818,13 +819,12 @@ main(int argc, char **argv)
exit(1);
}
/* Schedule a neighbours check after roughly 3/2 times msecs have elapsed. */
void
schedule_neighbours_check(int msecs, int override)
{
struct timeval timeout;
timeval_add_msec(&timeout, &now, roughly(msecs * 3 / 2));
timeval_add_msec(&timeout, &now, roughly(msecs));
if(override)
check_neighbours_timeout = timeout;
else
......
......@@ -274,7 +274,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
changed = update_neighbour(neigh, seqno, interval);
update_neighbour_metric(neigh, changed);
if(interval > 0)
schedule_neighbours_check(interval * 10, 0);
/* Multiply by 3/2 to allow hellos to expire. */
schedule_neighbours_check(interval * 15, 0);
} else if(type == MESSAGE_IHU) {
unsigned short txcost, interval;
unsigned char address[16];
......@@ -295,7 +296,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
neigh->ihu_interval = interval;
update_neighbour_metric(neigh, changed);
if(interval > 0)
schedule_neighbours_check(interval * 10 * 3, 0);
/* Multiply by 3/2 to allow neighbours to expire. */
schedule_neighbours_check(interval * 45, 0);
}
} else if(type == MESSAGE_ROUTER_ID) {
if(len < 10) {
......
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