fix rpl_dag_update_state() logic in case the preferred parent already has been cleared
@@ -327,6 +327,8 @@ rpl_dag_update_state(void)
/* Parent switch */
if(curr_instance.dag.unprocessed_parent_switch) {
+
+ if(curr_instance.dag.preferred_parent != NULL) {
/* We just got a parent (was NULL), reset trickle timer to advertise this */
if(old_parent == NULL) {
curr_instance.dag.state = DAG_JOINED;
@@ -336,9 +338,7 @@ rpl_dag_update_state(void)
LOG_WARN_(", staying in DAG\n");
rpl_timers_unschedule_leaving();
}
-
/* Schedule a DAO */
- if(curr_instance.dag.preferred_parent != NULL) {
rpl_timers_schedule_dao();
} else {
/* We have no more parent, schedule DIS to get a chance to hear updated state */
