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