ensure that all the tracker destruction code is done in the libevent thread, for a cleaner shutdown

This commit is contained in:
Charles Kerr 2007-08-21 00:01:14 +00:00
parent 624257c995
commit 8c54b7eb46
1 changed files with 12 additions and 2 deletions

View File

@ -370,9 +370,10 @@ escape( char * out, const uint8_t * in, int in_len ) /* rfc2396 */
*out = '\0';
}
void
tr_trackerFree( Torrent * tor )
static int
onTorrentFreeNow( void * vtor )
{
Torrent * tor = (Torrent *) vtor;
Tracker * t = tor->tracker;
tr_ptrArrayRemoveSorted( t->torrents, tor, torrentCompare );
@ -410,6 +411,15 @@ tr_trackerFree( Torrent * tor )
tr_free( t->tierFronts );
tr_free( t );
}
return FALSE;
}
void
tr_trackerFree( Torrent * tor )
{
tr_timerNew( tor->tracker->handle,
onTorrentFreeNow, tor, NULL, 0 );
}
Torrent*