fix crash-on-shutdown bug reported by BentMyWookie

This commit is contained in:
Charles Kerr 2007-08-19 02:55:11 +00:00
parent 466325fa92
commit 47f1457d67
1 changed files with 7 additions and 2 deletions

View File

@ -374,7 +374,11 @@ tr_trackerFree( Torrent * tor )
Tracker * t = tor->tracker; Tracker * t = tor->tracker;
tr_ptrArrayRemoveSorted( t->torrents, tor, torrentCompare ); tr_ptrArrayRemoveSorted( t->torrents, tor, torrentCompare );
tr_ptrArrayRemoveSorted( t->scrapeQueue, tor, torrentCompare );
tr_ptrArrayRemoveSorted( t->scraping, tor, torrentCompare );
tr_timerFree( &tor->scrapeTag );
tr_timerFree( &tor->reannounceTag );
tr_publisherFree( tor->publisher ); tr_publisherFree( tor->publisher );
tr_free( tor->trackerID ); tr_free( tor->trackerID );
tr_free( tor->lastRequest ); tr_free( tor->lastRequest );
@ -397,6 +401,8 @@ tr_trackerFree( Torrent * tor )
tr_free( t->redirect ); tr_free( t->redirect );
} }
tr_timerFree( &t->scrapeTag );
tr_free( t->primaryAddress ); tr_free( t->primaryAddress );
tr_free( t->addresses ); tr_free( t->addresses );
tr_free( t->tierFronts ); tr_free( t->tierFronts );
@ -551,9 +557,9 @@ static int
onTorrentScrapeNow( void * vtor ) onTorrentScrapeNow( void * vtor )
{ {
Torrent * tor = (Torrent *) vtor; Torrent * tor = (Torrent *) vtor;
tr_timerFree( &tor->scrapeTag );
tr_ptrArrayInsertSorted( tor->tracker->scrapeQueue, tor, torrentCompare ); tr_ptrArrayInsertSorted( tor->tracker->scrapeQueue, tor, torrentCompare );
tr_trackerScrapeSoon( tor->tracker ); tr_trackerScrapeSoon( tor->tracker );
tor->scrapeTag = NULL;
return FALSE; return FALSE;
} }
@ -605,7 +611,6 @@ onScrapeResponse( struct evhttp_request * req, void * vt )
if(( flags = tr_bencDictFind( tordict, "flags" ))) if(( flags = tr_bencDictFind( tordict, "flags" )))
if(( tmp = tr_bencDictFind( flags, "min_request_interval"))) if(( tmp = tr_bencDictFind( flags, "min_request_interval")))
t->scrapeIntervalMsec = tmp->val.i * 1000; t->scrapeIntervalMsec = tmp->val.i * 1000;
assert( tr_ptrArrayFindSorted(t->scraping,tor,torrentCompare) ); assert( tr_ptrArrayFindSorted(t->scraping,tor,torrentCompare) );
tr_ptrArrayRemoveSorted( t->scraping, tor, torrentCompare ); tr_ptrArrayRemoveSorted( t->scraping, tor, torrentCompare );