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:
parent
ea40c4ac45
commit
6d5182af60
1 changed files with 16 additions and 6 deletions
|
@ -402,19 +402,29 @@ compareRecheckByTorrent( const void * va, const void * vb )
|
||||||
void
|
void
|
||||||
tr_ioRecheckRemove( tr_torrent * tor )
|
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;
|
stopCurrent = TRUE;
|
||||||
while( stopCurrent )
|
while( stopCurrent )
|
||||||
tr_wait( 50 );
|
{
|
||||||
} else {
|
tr_lockUnlock( lock );
|
||||||
|
tr_wait( 100 );
|
||||||
|
tr_lockLock( lock );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
struct recheck_node tmp;
|
struct recheck_node tmp;
|
||||||
tmp.torrent = tor;
|
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 );
|
tr_free( node );
|
||||||
tor->recheckState = TR_RECHECK_NONE;
|
tor->recheckState = TR_RECHECK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_lockUnlock( getRecheckLock( ) );
|
tr_lockUnlock( lock );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue