summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-11-13 10:11:31 +0100
committerSylvain Munaut <tnt@246tNt.com>2011-11-13 10:11:31 +0100
commita71b8eaca7eed4dfc96f2cebabfc26430416c2e9 (patch)
treeb1f04f3dbd0f41364df61982bdb22222f2ac99d3
parentcc90d494ceaa3b096b8102bc590fcbe9e6671c6f (diff)
timer: Better fix to the timer re-scheduling situation
As it turns out, the previous fix didn't cover the case of a timer X being re-scheduled inside a timer call back expiring at the same time as the previous X instance. Written-by: Pablo Neira Ayuso <pablo@gnumonks.org> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/timer.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/timer.c b/src/timer.c
index 77fb0039..79d4ad6d 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -69,12 +69,9 @@ static void __add_timer(struct osmo_timer_list *timer)
*/
void osmo_timer_add(struct osmo_timer_list *timer)
{
- if (timer->active) {
- rb_erase(&timer->node, &timer_root);
- } else {
- timer->active = 1;
- INIT_LLIST_HEAD(&timer->list);
- }
+ osmo_timer_del(timer);
+ timer->active = 1;
+ INIT_LLIST_HEAD(&timer->list);
__add_timer(timer);
}