Merge pull request #235 from cetic/fix-rpl-classic-select-dag-over-all-dodags
Always try to find the best dag (rpl-classic)
This commit is contained in:
commit
be5c325092
@ -762,22 +762,17 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p)
|
||||
old_rank = instance->current_dag->rank;
|
||||
last_parent = instance->current_dag->preferred_parent;
|
||||
|
||||
best_dag = instance->current_dag;
|
||||
if(best_dag->rank != ROOT_RANK(instance)) {
|
||||
if(rpl_select_parent(p->dag) != NULL) {
|
||||
if(p->dag != best_dag) {
|
||||
best_dag = instance->of->best_dag(best_dag, p->dag);
|
||||
}
|
||||
} else if(p->dag == best_dag) {
|
||||
best_dag = NULL;
|
||||
for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) {
|
||||
if(dag->used && dag->preferred_parent != NULL && dag->preferred_parent->rank != RPL_INFINITE_RANK) {
|
||||
if(best_dag == NULL) {
|
||||
best_dag = dag;
|
||||
} else {
|
||||
best_dag = instance->of->best_dag(best_dag, dag);
|
||||
}
|
||||
}
|
||||
if(instance->current_dag->rank != ROOT_RANK(instance)) {
|
||||
rpl_select_parent(p->dag);
|
||||
}
|
||||
|
||||
best_dag = NULL;
|
||||
for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DAG_PER_INSTANCE; dag < end; ++dag) {
|
||||
if(dag->used && dag->preferred_parent != NULL && dag->preferred_parent->rank != RPL_INFINITE_RANK) {
|
||||
if(best_dag == NULL) {
|
||||
best_dag = dag;
|
||||
} else {
|
||||
best_dag = instance->of->best_dag(best_dag, dag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user