Don't remove all parents that have a worse rank than an incoming DIO: we may inadvertently remove our preferred parent. Instead, remove parents with a rank that is worse than our preferred parent. If we are lucky, this will give us enough space for the new parent.

This commit is contained in:
Adam Dunkels 2011-02-13 14:16:15 +01:00
parent f1ac94e415
commit 2a96835c05

View File

@ -682,7 +682,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
if(p == NULL) {
if(RPL_PARENT_COUNT(dag) == RPL_MAX_PARENTS) {
/* Try to make room for a new parent. */
remove_parents(dag, dio->rank);
remove_parents(dag, dag->preferred_parent->rank + dag->min_hoprankinc);
}
/* Add the DIO sender as a candidate parent. */