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
1 changed files with 3 additions and 3 deletions

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] );