diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-11-11 18:57:59 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-11-12 23:23:35 +0100 |
commit | aeeb7070f84437aa608a3d843346b1efa916d175 (patch) | |
tree | 8426fdf3e1392c2e235add417020078511c21df0 /src | |
parent | 54187ba442e16df7346acc8ba68f80ce3239e6b0 (diff) |
core/timer: Allow an already scheduled timer to be re-scheduled at a new time
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/timer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/timer.c b/src/timer.c index 217f6521..77fb0039 100644 --- a/src/timer.c +++ b/src/timer.c @@ -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); } |