Don't add neighbor as a potential parent if its rank is too high.

This commit is contained in:
Adam Dunkels 2011-02-13 18:05:28 +01:00
parent 2a96835c05
commit e980072817

View file

@ -679,7 +679,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
*/ */
p = rpl_find_parent(dag, from); p = rpl_find_parent(dag, from);
if(p == NULL) { if(p == NULL && (dio->rank <= dag->preferred_parent->rank)) {
if(RPL_PARENT_COUNT(dag) == RPL_MAX_PARENTS) { if(RPL_PARENT_COUNT(dag) == RPL_MAX_PARENTS) {
/* Try to make room for a new parent. */ /* Try to make room for a new parent. */
remove_parents(dag, dag->preferred_parent->rank + dag->min_hoprankinc); remove_parents(dag, dag->preferred_parent->rank + dag->min_hoprankinc);