From f92fd55a803c1ea106c7fdc441d45111cb1dc34c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 9 Oct 2009 20:06:22 +0000 Subject: [PATCH] (trunk libT) add a couple more debugging assertions into the nightlies to try & smoke out the handshake/peer-io crashes --- libtransmission/bandwidth.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.c index ac7f4d680..b12c273e1 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.c @@ -119,11 +119,18 @@ tr_bandwidthSetParent( tr_bandwidth * b, assert( tr_isBandwidth( b ) ); assert( b != parent ); +//fprintf( stderr, "setting parent for %p: %p\n", b, parent ); if( b->parent ) { + void * removed; + assert( tr_isBandwidth( b->parent ) ); - tr_ptrArrayRemoveSorted( &b->parent->children, b, comparePointers ); + removed = tr_ptrArrayRemoveSorted( &b->parent->children, b, comparePointers ); + assert( removed == b ); + assert( tr_ptrArrayFindSorted( &b->parent->children, b, comparePointers ) == NULL ); +//fprintf( stderr, "removed child bandwidth %p from old parent %p\n", b, b->parent ); + b->parent = NULL; } @@ -133,6 +140,8 @@ tr_bandwidthSetParent( tr_bandwidth * b, assert( parent->parent != b ); tr_ptrArrayInsertSorted( &parent->children, b, comparePointers ); + assert( tr_ptrArrayFindSorted( &parent->children, b, comparePointers ) == b ); +//fprintf( stderr, "set new parent for %p: %p\n", b, parent ); b->parent = parent; } }