rpl-lite parent selection: if the preferred parent is still best but no longer fresh, stick to it and use urgent probing to get it fresh again

This commit is contained in:
Simon Duquennoy 2017-06-29 09:25:21 +02:00
parent a791f46002
commit e7385ab2c0
1 changed files with 9 additions and 0 deletions

View File

@ -336,6 +336,7 @@ rpl_neighbor_select_best(void)
#if RPL_WITH_PROBING
if(best != NULL) {
if(rpl_neighbor_is_fresh(best)) {
/* Return best if it is fresh */
return best;
} else {
rpl_nbr_t *best_fresh;
@ -350,6 +351,13 @@ rpl_neighbor_select_best(void)
rpl_schedule_probing();
}
/* The best is our preferred parent. It is not fresh but used to be,
else we would not have selected it in the first place. Stick to it
for a little while and rely on urgent probing to make a call. */
if(best == curr_instance.dag.preferred_parent) {
return best;
}
/* Look for the best fresh parent. */
best_fresh = best_parent(1);
if(best_fresh == NULL) {
@ -367,6 +375,7 @@ rpl_neighbor_select_best(void)
}
}
} else {
/* No acceptable parent */
return NULL;
}
#else /* RPL_WITH_PROBING */