#980 optimistic unchoking is broken

This commit is contained in:
Charles Kerr 2008-05-30 12:58:55 +00:00
parent 8a876d755a
commit e9c7e76c07
1 changed files with 2 additions and 5 deletions

View File

@ -1532,7 +1532,7 @@ getWeightedRate( const tr_peer * peer, int clientIsSeed )
static void
rechoke( Torrent * t )
{
int i, n, peerCount, size, unchokedInterested;
int i, peerCount, size, unchokedInterested;
tr_peer ** peers = getConnectedPeers( t, &peerCount );
struct ChokeData * choke = tr_new0( struct ChokeData, peerCount );
const int clientIsSeed = tr_torrentIsSeed( t->tor );
@ -1574,9 +1574,6 @@ rechoke( Torrent * t )
if( choke[i].isInterested )
++unchokedInterested;
}
n = i;
while( i<size )
choke[i++].doUnchoke = 0;
/* optimistic unchoke */
if( i < size )
@ -1593,7 +1590,7 @@ rechoke( Torrent * t )
tr_ptrArrayAppend( randPool, choke );
}
i = tr_rand( tr_ptrArraySize( randPool ) );
c = ( struct ChokeData* )tr_ptrArrayNth( randPool, i);
c = tr_ptrArrayNth( randPool, i);
c->doUnchoke = 1;
t->optimistic = c->peer;
tr_ptrArrayFree( randPool, NULL );