mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-27 07:21:18 +01:00
gnrc_rpl_p2p: fix cleanup timer usage
This commit is contained in:
parent
da78d03e95
commit
4b58e5d41b
@ -147,6 +147,14 @@ bool gnrc_rpl_parent_remove(gnrc_rpl_parent_t *parent);
|
||||
*/
|
||||
void gnrc_rpl_parent_update(gnrc_rpl_dodag_t *dodag, gnrc_rpl_parent_t *parent);
|
||||
|
||||
/**
|
||||
* @brief Removes the dodag state of @p dodag after
|
||||
* GNRC_RPL_CLEANUP_TIME milliseconds
|
||||
*
|
||||
* @param[in] dodag Pointer to the DODAG
|
||||
*/
|
||||
void gnrc_rpl_cleanup_start(gnrc_rpl_dodag_t *dodag);
|
||||
|
||||
/**
|
||||
* @brief Start a local repair.
|
||||
*
|
||||
|
||||
@ -246,6 +246,14 @@ bool gnrc_rpl_parent_remove(gnrc_rpl_parent_t *parent)
|
||||
return true;
|
||||
}
|
||||
|
||||
void gnrc_rpl_cleanup_start(gnrc_rpl_dodag_t *dodag)
|
||||
{
|
||||
evtimer_del((evtimer_t *)(&gnrc_rpl_evtimer), (evtimer_event_t *)&dodag->instance->cleanup_event);
|
||||
((evtimer_event_t *)&(dodag->instance->cleanup_event))->offset = GNRC_RPL_CLEANUP_TIME;
|
||||
dodag->instance->cleanup_event.msg.type = GNRC_RPL_MSG_TYPE_INSTANCE_CLEANUP;
|
||||
evtimer_add_msg(&gnrc_rpl_evtimer, &dodag->instance->cleanup_event, gnrc_rpl_pid);
|
||||
}
|
||||
|
||||
void gnrc_rpl_local_repair(gnrc_rpl_dodag_t *dodag)
|
||||
{
|
||||
DEBUG("RPL: [INFO] Local Repair started\n");
|
||||
@ -260,10 +268,7 @@ void gnrc_rpl_local_repair(gnrc_rpl_dodag_t *dodag)
|
||||
if (dodag->my_rank != GNRC_RPL_INFINITE_RANK) {
|
||||
dodag->my_rank = GNRC_RPL_INFINITE_RANK;
|
||||
trickle_reset_timer(&dodag->trickle);
|
||||
evtimer_del((evtimer_t *)(&gnrc_rpl_evtimer), (evtimer_event_t *)&dodag->instance->cleanup_event);
|
||||
((evtimer_event_t *)&(dodag->instance->cleanup_event))->offset = GNRC_RPL_CLEANUP_TIME;
|
||||
dodag->instance->cleanup_event.msg.type = GNRC_RPL_MSG_TYPE_INSTANCE_CLEANUP;
|
||||
evtimer_add_msg(&gnrc_rpl_evtimer, &dodag->instance->cleanup_event, gnrc_rpl_pid);
|
||||
gnrc_rpl_cleanup_start(dodag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ void gnrc_rpl_p2p_update(void)
|
||||
p2p_ext->lifetime_sec -= GNRC_RPL_LIFETIME_UPDATE_STEP;
|
||||
if (p2p_ext->lifetime_sec <= 0) {
|
||||
gnrc_rpl_dodag_remove_all_parents(p2p_ext->dodag);
|
||||
p2p_ext->dodag->instance->cleanup = GNRC_RPL_CLEANUP_TIME;
|
||||
gnrc_rpl_cleanup_start(p2p_ext->dodag);
|
||||
continue;
|
||||
}
|
||||
p2p_ext->dro_delay -= GNRC_RPL_LIFETIME_UPDATE_STEP;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user