Make RPL DIS transmission interval random in the interval [0, INTERVAL/2]. This is needed to avoid synchronization in large RPL networks.

This commit is contained in:
Adam Dunkels 2012-11-26 19:36:51 +01:00
parent 2396f9b8ea
commit 2a2175a214

View file

@ -168,7 +168,9 @@ handle_dio_timer(void *ptr)
void
rpl_reset_periodic_timer(void)
{
next_dis = RPL_DIS_INTERVAL - RPL_DIS_START_DELAY;
next_dis = RPL_DIS_INTERVAL / 2 +
((uint32_t)RPL_DIS_INTERVAL * (uint32_t)random_rand()) / RANDOM_RAND_MAX -
RPL_DIS_START_DELAY;
ctimer_set(&periodic_timer, CLOCK_SECOND, handle_periodic_timer, NULL);
}
/*---------------------------------------------------------------------------*/