Ugly workaround for the deadlock introduced in [1445]
This commit is contained in:
parent
ddcfa59c96
commit
706a2ade11
|
@ -209,10 +209,22 @@ int tr_peerRead( tr_peer_t * peer )
|
|||
/* Try to read */
|
||||
for( ;; )
|
||||
{
|
||||
if( tor && ( ( !tor->customSpeedLimit && !tr_rcCanGlobalTransfer( tor->handle, 0 ) )
|
||||
|| ( tor->customSpeedLimit && !tr_rcCanTransfer( tor->download ) ) ) )
|
||||
if( tor )
|
||||
{
|
||||
break;
|
||||
if( !tor->customSpeedLimit )
|
||||
{
|
||||
tr_lockUnlock( &tor->lock );
|
||||
if( !tr_rcCanGlobalTransfer( tor->handle, 0 ) )
|
||||
{
|
||||
tr_lockLock( &tor->lock );
|
||||
break;
|
||||
}
|
||||
tr_lockLock( &tor->lock );
|
||||
}
|
||||
else if( !tr_rcCanTransfer( tor->download ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( peer->size < 1 )
|
||||
|
@ -386,8 +398,17 @@ writeBegin:
|
|||
/* Send pieces if we can */
|
||||
while( ( p = blockPending( tor, peer, &size ) ) )
|
||||
{
|
||||
if( ( !tor->customSpeedLimit && !tr_rcCanGlobalTransfer( tor->handle, 1 ) )
|
||||
|| ( tor->customSpeedLimit && !tr_rcCanTransfer( tor->upload ) ) )
|
||||
if( !tor->customSpeedLimit )
|
||||
{
|
||||
tr_lockUnlock( &tor->lock );
|
||||
if( !tr_rcCanGlobalTransfer( tor->handle, 1 ) )
|
||||
{
|
||||
tr_lockLock( &tor->lock );
|
||||
break;
|
||||
}
|
||||
tr_lockLock( &tor->lock );
|
||||
}
|
||||
else if( !tr_rcCanTransfer( tor->upload ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue