Commit 33ac9254 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Be somewhat less silly when updating neighbour reachability.

parent 7363fe9c
...@@ -125,11 +125,11 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -125,11 +125,11 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
} else { } else {
if(neigh->hello_seqno >= 0 && neigh->reach > 0) { if(neigh->hello_seqno >= 0 && neigh->reach > 0) {
missed_hellos = seqno_minus(hello, neigh->hello_seqno) - 1; missed_hellos = seqno_minus(hello, neigh->hello_seqno) - 1;
while(missed_hellos < 0) { if(missed_hellos < 0) {
/* This neighbour has increased its hello interval, and we /* This neighbour has increased its hello interval, and we
didn't notice. */ didn't notice. */
neigh->reach <<= 1; neigh->reach <<= -missed_hellos;
missed_hellos++; missed_hellos = 0;
} }
} else { } else {
missed_hellos = 0; missed_hellos = 0;
...@@ -138,10 +138,8 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -138,10 +138,8 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
neigh->hello_interval = hello_interval; neigh->hello_interval = hello_interval;
} }
while(missed_hellos) { neigh->reach >>= missed_hellos;
neigh->reach >>= 1; missed_hellos = 0;
missed_hellos--;
}
if(hello >= 0) { if(hello >= 0) {
neigh->hello_seqno = hello; neigh->hello_seqno = hello;
......
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