1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

Fixed a lame typo so the algorithm may actually work

This commit is contained in:
Eric Petit 2006-01-31 04:58:28 +00:00
parent 8c8b2dbc19
commit aa6c52ef46

View file

@ -132,7 +132,7 @@ void tr_chokingPulse( tr_choking_t * c )
sortPeers( peersCanChoke, peersCanChokeCount );
sortPeers( peersCanUnchoke, peersCanUnchokeCount );
if( unchokedCount > c->slots )
if( unchokedCount > c->slots && peersCanChokeCount > 0 )
{
int willChoke;
willChoke = MIN( peersCanChokeCount, unchokedCount - c->slots );
@ -142,7 +142,7 @@ void tr_chokingPulse( tr_choking_t * c )
memmove( &peersCanChoke[0], &peersCanChoke[willChoke],
peersCanChokeCount );
}
else if( unchokedCount < c->slots )
else if( unchokedCount < c->slots && peersCanUnchokeCount > 0 )
{
int willUnchoke;
willUnchoke = MIN( peersCanUnchokeCount, c->slots - unchokedCount );
@ -154,7 +154,7 @@ void tr_chokingPulse( tr_choking_t * c )
while( peersCanChokeCount > 0 && peersCanUnchokeCount > 0 )
{
if( tr_peerDownloadRate( peersCanUnchoke[peersCanUnchokeCount - 1] )
> tr_peerDownloadRate( peersCanChoke[0] ) )
< tr_peerDownloadRate( peersCanChoke[0] ) )
break;
tr_peerChoke( peersCanChoke[0] );