1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

fix potential "recheck torrent" deadlock

This commit is contained in:
Charles Kerr 2007-10-06 01:43:04 +00:00
parent ea40c4ac45
commit 6d5182af60

View file

@ -402,19 +402,29 @@ compareRecheckByTorrent( const void * va, const void * vb )
void
tr_ioRecheckRemove( tr_torrent * tor )
{
tr_lockLock( getRecheckLock( ) );
tr_lock * lock = getRecheckLock( );
tr_lockLock( lock );
if( tor == currentNode.torrent ) {
if( tor == currentNode.torrent )
{
stopCurrent = TRUE;
while( stopCurrent )
tr_wait( 50 );
} else {
{
tr_lockUnlock( lock );
tr_wait( 100 );
tr_lockLock( lock );
}
}
else
{
struct recheck_node tmp;
tmp.torrent = tor;
struct recheck_node * node = tr_list_remove( &recheckList, &tmp, compareRecheckByTorrent );
struct recheck_node * node = tr_list_remove( &recheckList,
&tmp,
compareRecheckByTorrent );
tr_free( node );
tor->recheckState = TR_RECHECK_NONE;
}
tr_lockUnlock( getRecheckLock( ) );
tr_lockUnlock( lock );
}