Update the metric container correctly. Use only one ETX initializer.

This commit is contained in:
Nicolas Tsiftes 2011-03-16 13:29:01 +01:00
parent eee9a68b12
commit 65366d10c1
5 changed files with 22 additions and 28 deletions

View file

@ -94,8 +94,6 @@ static rpl_of_t * const objective_functions[] = {&RPL_OF};
#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS
#endif /* !RPL_CONF_DIO_INTERVAL_DOUBLINGS */
#define INITIAL_ETX NEIGHBOR_INFO_ETX_DIVISOR * 5
/************************************************************************/
/* Allocate parents from the same static MEMB chunk to reduce memory waste. */
MEMB(parent_memb, struct rpl_parent, RPL_MAX_PARENTS);
@ -309,7 +307,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
memcpy(&p->addr, addr, sizeof(p->addr));
p->dag = dag;
p->rank = dio->rank;
p->etx = INITIAL_ETX;
p->link_metric = INITIAL_LINK_METRIC;
p->dtsn = 0;
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
@ -459,8 +457,6 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
}
PRINTF("succeeded\n");
p->etx = INITIAL_ETX; /* The lowest confidence for new parents. */
/* Determine the objective function by using the
objective code point of the DIO. */
of = rpl_find_of(dio->ocp);
@ -733,7 +729,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
PRINTF(")\n");
return;
}
PRINTF("RPL: New candidate parent with rank %u: ", (unsigned)p->rank);
PRINT6ADDR(from);
PRINTF("\n");
@ -743,7 +739,8 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
}
/* We have allocated a candidate parent; process the DIO further. */
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
p->rank = dio->rank;
if(rpl_process_parent_event(dag, p) == 0) {
/* The candidate parent no longer exists. */