Avoid hysteresis check if neither p1 nor p2 is the preferred parent.
This commit is contained in:
parent
dd7cec737d
commit
a7addf990f
|
@ -153,6 +153,7 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
|
||||||
p2_etx = calculate_etx(p2);
|
p2_etx = calculate_etx(p2);
|
||||||
|
|
||||||
/* Maintain stability of the preferred parent in case of similar ranks. */
|
/* Maintain stability of the preferred parent in case of similar ranks. */
|
||||||
|
if(p1 == dag->preferred_parent || p2 == dag->preferred_parent) {
|
||||||
if(p1_etx < p2_etx + min_diff &&
|
if(p1_etx < p2_etx + min_diff &&
|
||||||
p1_etx > p2_etx - min_diff) {
|
p1_etx > p2_etx - min_diff) {
|
||||||
PRINTF("RPL: MRHOF hysteresis: %u <= %u <= %u\n",
|
PRINTF("RPL: MRHOF hysteresis: %u <= %u <= %u\n",
|
||||||
|
@ -161,6 +162,7 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
|
||||||
p2_etx + min_diff);
|
p2_etx + min_diff);
|
||||||
return dag->preferred_parent;
|
return dag->preferred_parent;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return p1_etx < p2_etx ? p1 : p2;
|
return p1_etx < p2_etx ? p1 : p2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue