#980 optimistic unchoking is broken
This commit is contained in:
parent
8a876d755a
commit
e9c7e76c07
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue