Commit 1ec85ef8 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Tweak cost calculation to be more tolerant of occasional loss.

parent 5c7f5d1e
...@@ -311,9 +311,12 @@ neighbour_rxcost(struct neighbour *neigh) ...@@ -311,9 +311,12 @@ neighbour_rxcost(struct neighbour *neigh)
else else
return INFINITY; return INFINITY;
} else { } else {
int sreach = (reach & 0x7FFF) + ((reach & 0x8000) >> 1); int sreach =
/* 0 <= sreach <= 0xBFFF */ ((reach & 0x8000) >> 2) +
int cost = (0xC000 * neigh->network->cost) / (sreach + 1); ((reach & 0x4000) >> 1) +
(reach & 0x3FFF);
/* 0 <= sreach <= 0x7FFF */
int cost = (0x8000 * neigh->network->cost) / (sreach + 1);
/* cost >= network->cost */ /* cost >= network->cost */
if(delay >= 40000) if(delay >= 40000)
cost = (cost * (delay - 20000) + 10000) / 20000; cost = (cost * (delay - 20000) + 10000) / 20000;
......
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