Commit 3c017806 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Initialise hello_seqno when creating new neighbour.

parent a9bc5ae9
...@@ -108,6 +108,8 @@ add_neighbour(const unsigned char *id, const unsigned char *address, ...@@ -108,6 +108,8 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
neigh->txcost = INFINITY; neigh->txcost = INFINITY;
neigh->txcost_time = now.tv_sec; neigh->txcost_time = now.tv_sec;
neigh->hello_time = 0; neigh->hello_time = 0;
neigh->hello_interval = 0;
neigh->hello_seqno = -1;
neigh->network = net; neigh->network = net;
send_hello(net); send_hello(net);
return neigh; return neigh;
...@@ -127,7 +129,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -127,7 +129,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
return; return;
neigh->hello_time += missed_hellos * neigh->hello_interval; neigh->hello_time += missed_hellos * neigh->hello_interval;
} else { } else {
if(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) { while(missed_hellos < 0) {
/* This neighbour has increased its hello interval, and we /* This neighbour has increased its hello interval, and we
......
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