summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-11-11 18:57:59 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-12 23:23:35 +0100
commitaeeb7070f84437aa608a3d843346b1efa916d175 (patch)
tree8426fdf3e1392c2e235add417020078511c21df0
parent54187ba442e16df7346acc8ba68f80ce3239e6b0 (diff)
core/timer: Allow an already scheduled timer to be re-scheduled at a new time
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/timer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/timer.c b/src/timer.c
index 217f652..77fb003 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);
}