From e7385ab2c0315cff02771088ee394f88ad152154 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 29 Jun 2017 09:25:21 +0200 Subject: [PATCH] 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 --- core/net/rpl-lite/rpl-neighbor.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/net/rpl-lite/rpl-neighbor.c b/core/net/rpl-lite/rpl-neighbor.c index c4b28c0e6..742e2397c 100644 --- a/core/net/rpl-lite/rpl-neighbor.c +++ b/core/net/rpl-lite/rpl-neighbor.c @@ -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 */