summaryrefslogtreecommitdiffstats
path: root/lib/qtimers.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2010-01-20 13:09:35 +0000
committerpaulo <paul@bayleaf.org.uk>2010-01-20 13:09:35 +0000
commit13fad04d09978db15317d3d3fb71ab87ea52c110 (patch)
treedca03d21ec9517db4ee837873e6d54736ea20286 /lib/qtimers.c
parent5b8978176cbefe7c38f3ed72fd863e2e313d86d8 (diff)
downloadquagga-13fad04d09978db15317d3d3fb71ab87ea52c110.tar.bz2
quagga-13fad04d09978db15317d3d3fb71ab87ea52c110.tar.xz
Fix bug in bgp_connection not clearing pointers after free. Planted
asserts to try to track timer crash.
Diffstat (limited to 'lib/qtimers.c')
-rw-r--r--lib/qtimers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/qtimers.c b/lib/qtimers.c
index 6b3db500..43335d55 100644
--- a/lib/qtimers.c
+++ b/lib/qtimers.c
@@ -87,6 +87,9 @@ qtimer_cmp(qtimer* a, qtimer* b) /* the heap discipline */
return 0 ;
} ;
+/* Kill this */
+qtimer_pile our_pile;
+
/*==============================================================================
* qtimer_pile handling
*/
@@ -113,6 +116,9 @@ qtimer_pile_init_new(qtimer_pile qtp)
heap_init_new_backlinked(&qtp->timers, 0, (heap_cmp*)qtimer_cmp,
offsetof(qtimer_t, backlink)) ;
+
+ /* TODO: kill this */
+ our_pile = qtp;
return qtp ;
} ;
@@ -151,9 +157,11 @@ qtimer_pile_dispatch_next(qtimer_pile qtp, qtime_mono_t upto)
qtr = heap_top_item(&qtp->timers) ;
if ((qtr != NULL) && (qtr->time <= upto))
{
+ passert(qtp == qtr->pile);
qtr->state = qtr_state_unset_pending ;
qtr->action(qtr, qtr->timer_info, upto) ;
+ assert(qtp == qtr->pile);
if (qtr->state == qtr_state_unset_pending)
qtimer_unset(qtr) ;
@@ -312,6 +320,7 @@ qtimer_set(qtimer qtr, qtime_mono_t when, qtimer_action* action)
qtp = qtr->pile ;
dassert(qtp != NULL) ;
+ assert(qtp == our_pile);
qtr->time = when ;
@@ -319,6 +328,7 @@ qtimer_set(qtimer qtr, qtime_mono_t when, qtimer_action* action)
heap_update_item(&qtp->timers, qtr) ; /* update in heap */
else
heap_push_item(&qtp->timers, qtr) ; /* add to heap */
+ assert(qtp == qtr->pile);
qtr->state = qtr_state_active ; /* overrides any unset pending */
@@ -339,8 +349,10 @@ qtimer_unset(qtimer qtr)
{
qtimer_pile qtp = qtr->pile ;
dassert(qtp != NULL) ;
+ assert(qtp == our_pile);
heap_delete_item(&qtp->timers, qtr) ;
+ assert(qtp == qtr->pile);
qtr->state = qtr_state_inactive ; /* overrides any unset pending */
} ;