Fix rpl_select_parent in the non-probing case

This commit is contained in:
Simon Duquennoy 2016-06-03 12:23:56 +02:00 committed by Simon Duquennoy
parent 43b01b3236
commit d008bf8a76

View File

@ -880,9 +880,9 @@ rpl_select_parent(rpl_dag_t *dag)
rpl_parent_t *best = best_parent(dag, 0);
if(best != NULL) {
#if RPL_WITH_PROBING
if(rpl_parent_is_fresh(best)) {
rpl_set_preferred_parent(dag, best);
dag->rank = rpl_rank_via_parent(dag->preferred_parent);
} else {
/* The best is not fresh. Look for the best fresh now. */
rpl_parent_t *best_fresh = best_parent(dag, 1);
@ -893,18 +893,20 @@ rpl_select_parent(rpl_dag_t *dag)
/* Use best fresh */
rpl_set_preferred_parent(dag, best_fresh);
}
#if RPL_WITH_PROBING
/* Probe the new best parent shortly in order to get a fresh estimate */
/* Probe the best parent shortly in order to get a fresh estimate */
dag->instance->urgent_probing_target = best;
rpl_schedule_probing(dag->instance);
#else /* RPL_WITH_PROBING */
rpl_set_preferred_parent(dag, best);
dag->rank = rpl_rank_via_parent(dag->preferred_parent);
#endif /* RPL_WITH_PROBING */
}
} else {
rpl_set_preferred_parent(dag, best);
dag->rank = INFINITE_RANK;
rpl_set_preferred_parent(dag, NULL);
}
return best;
dag->rank = rpl_rank_via_parent(dag->preferred_parent);
return dag->preferred_parent;
}
/*---------------------------------------------------------------------------*/
void