From 41db262c607b7987583494004dbfa467d2a70da7 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 30 Oct 2012 21:39:43 +0100 Subject: [PATCH] Mainloop: Fixed position tracking in timer heaps --- ucw/mainloop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ucw/mainloop.c b/ucw/mainloop.c index e2b96826..b5e54965 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -259,9 +259,9 @@ timer_add(struct main_timer *tm, timestamp_t expires) if (!tm->expires) { tm->expires = expires; - tm->index = num_timers; + tm->index = num_timers + 1; GARY_RESIZE(m->timer_table, num_timers + 2); - HEAP_INSERT(struct main_timer *, m->timer_table, tm->index, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); + HEAP_INSERT(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); } else { -- 2.39.2