RPL: when no probing target is found, probe least recently updated parent

This commit is contained in:
Simon Duquennoy 2015-05-10 13:28:00 +02:00
parent 832a4d3e01
commit 9ced5b7bac
1 changed files with 7 additions and 6 deletions

View File

@ -354,11 +354,11 @@ get_probing_target(rpl_dag_t *dag)
/* Our preferred parent needs probing */
if(dag->preferred_parent->last_tx_time < min_last_tx) {
return dag->preferred_parent;
probing_target = dag->preferred_parent;
}
if((random_rand() % 2) == 0) {
/* With 1/2 probability: probe best parent not updated for RPL_PROBING_EXPIRATION_TIME */
/* With 50% probability: probe best parent not updated for RPL_PROBING_EXPIRATION_TIME */
if(probing_target == NULL && (random_rand() % 2) == 0) {
p = nbr_table_head(rpl_parents);
while(p != NULL) {
if(p->dag == dag && p->last_tx_time < min_last_tx) {
@ -372,8 +372,10 @@ get_probing_target(rpl_dag_t *dag)
}
p = nbr_table_next(rpl_parents, p);
}
} else {
/* With 1/2 probability: probe the least recently updated parent */
}
/* The default probing target is the least recently updated parent */
if(probing_target == NULL) {
p = nbr_table_head(rpl_parents);
while(p != NULL) {
if(p->dag == dag) {
@ -384,7 +386,6 @@ get_probing_target(rpl_dag_t *dag)
}
p = nbr_table_next(rpl_parents, p);
}
}
return probing_target;