diff --git a/core/net/rpl/rpl-conf.h b/core/net/rpl/rpl-conf.h index d3749e033..11d2cdbd0 100644 --- a/core/net/rpl/rpl-conf.h +++ b/core/net/rpl/rpl-conf.h @@ -249,4 +249,14 @@ #define RPL_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr)) #endif +/* + * Function used to calculate next RPL probing interval + * */ +#ifdef RPL_CONF_PROBING_DELAY_FUNC +#define RPL_PROBING_DELAY_FUNC RPL_CONF_PROBING_DELAY_FUNC +#else +#define RPL_PROBING_DELAY_FUNC() ((RPL_PROBING_INTERVAL / 2) \ + + random_rand() % (RPL_PROBING_INTERVAL)) +#endif + #endif /* RPL_CONF_H */ diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index 7a7a7a2ef..fac19ee4f 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -414,9 +414,7 @@ handle_probing_timer(void *ptr) void rpl_schedule_probing(rpl_instance_t *instance) { - clock_time_t delay = (RPL_PROBING_INTERVAL / 2) + - random_rand() % (RPL_PROBING_INTERVAL / 2); - ctimer_set(&instance->probing_timer, delay, + ctimer_set(&instance->probing_timer, RPL_PROBING_DELAY_FUNC(), handle_probing_timer, instance); } #endif /* RPL_WITH_PROBING */