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:
Simon Duquennoy 2017-12-12 13:54:40 +01:00 committed by GitHub
commit be5c325092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}
}