Do not force DIO reset on certain events where it is not needed.

This commit is contained in:
Nicolas Tsiftes 2011-11-16 09:49:22 +01:00
parent b405571e32
commit ea73f1d767
4 changed files with 19 additions and 18 deletions

View file

@ -986,7 +986,7 @@ rpl_local_repair(rpl_instance_t *instance)
}
}
rpl_reset_dio_timer(instance,1);
rpl_reset_dio_timer(instance, 0);
RPL_STAT(rpl_stats.local_repairs++);
}
@ -1122,7 +1122,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
PRINTF("RPL: Root received inconsistent DIO version number\n");
dag->version = dio->version;
RPL_LOLLIPOP_INCREMENT(dag->version);
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
} else {
global_repair(from, dag, dio);
}
@ -1132,7 +1132,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
/* Inconsistency detected - someone is still on old version */
PRINTF("RPL: old version received => inconsistency detected\n");
if(dag->joined) {
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
return;
}
}
@ -1140,7 +1140,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
if(dio->rank == INFINITE_RANK) {
if(dag->joined) {
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
}
} else if(dio->rank < ROOT_RANK(instance)) {
PRINTF("RPL: Ignoring DIO with too low rank: %u\n",

View file

@ -233,7 +233,7 @@ dio_input(void)
PRINTF("RPL: Incoming DIO DODAG ");
PRINT6ADDR(&dio.dag_id);
PRINTF(" preference : %u\n",dio.preference);
PRINTF(", preference: %u\n", dio.preference);
/* Check if there are any DIO suboptions. */
for(; i < buffer_length; i += len) {

View file

@ -178,7 +178,8 @@ void
rpl_reset_dio_timer(rpl_instance_t *instance, uint8_t force)
{
#if !RPL_LEAF_ONLY
/* only reset if not just reset or started */
/* Do not reset if we are already on the minimum interval,
unless forced to do so. */
if(force || instance->dio_intcurrent > instance->dio_intmin) {
instance->dio_counter = 0;
instance->dio_intcurrent = instance->dio_intmin;
@ -198,7 +199,7 @@ handle_dao_timer(void *ptr)
instance = (rpl_instance_t *)ptr;
if(!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) {
PRINTF("RPL: Postpone DAO transmission... \n");
PRINTF("RPL: Postpone DAO transmission\n");
ctimer_set(&instance->dao_timer, CLOCK_SECOND, handle_dao_timer, instance);
return;
}