core/timer: Allow an already scheduled timer to be re-scheduled at a new time

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2011-11-11 18:57:59 +01:00 committed by Harald Welte
parent 54187ba442
commit aeeb7070f8
1 changed files with 6 additions and 2 deletions

View File

@ -69,8 +69,12 @@ static void __add_timer(struct osmo_timer_list *timer)
*/
void osmo_timer_add(struct osmo_timer_list *timer)
{
timer->active = 1;
INIT_LLIST_HEAD(&timer->list);
if (timer->active) {
rb_erase(&timer->node, &timer_root);
} else {
timer->active = 1;
INIT_LLIST_HEAD(&timer->list);
}
__add_timer(timer);
}