Rename function to indicate its stupidity
This commit is contained in:
parent
e84275e429
commit
d712f22b21
|
@ -137,7 +137,7 @@ struct tr_peerMgr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tr_simpleRandInt( int sup )
|
tr_stupidRandInt( int sup )
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
assert( sup > 0 );
|
assert( sup > 0 );
|
||||||
|
@ -621,7 +621,7 @@ getPreferredPieces( Torrent * t,
|
||||||
setme->piece = piece;
|
setme->piece = piece;
|
||||||
setme->priority = inf->pieces[piece].priority;
|
setme->priority = inf->pieces[piece].priority;
|
||||||
setme->peerCount = 0;
|
setme->peerCount = 0;
|
||||||
setme->random = tr_simpleRandInt( UINT16_MAX );
|
setme->random = tr_stupidRandInt( UINT16_MAX );
|
||||||
setme->missingBlockCount = tr_cpMissingBlocksInPiece( tor->completion, piece );
|
setme->missingBlockCount = tr_cpMissingBlocksInPiece( tor->completion, piece );
|
||||||
|
|
||||||
for( k=0; k<peerCount; ++k ) {
|
for( k=0; k<peerCount; ++k ) {
|
||||||
|
@ -663,7 +663,7 @@ getPeersUploadingToClient( Torrent * t, int * setmeCount )
|
||||||
* get a chance at the first blocks in the queue */
|
* get a chance at the first blocks in the queue */
|
||||||
if( retCount ) {
|
if( retCount ) {
|
||||||
tr_peer ** tmp = tr_new( tr_peer*, retCount );
|
tr_peer ** tmp = tr_new( tr_peer*, retCount );
|
||||||
i = tr_simpleRandInt( retCount );
|
i = tr_stupidRandInt( retCount );
|
||||||
memcpy( tmp, ret, sizeof(tr_peer*) * retCount );
|
memcpy( tmp, ret, sizeof(tr_peer*) * retCount );
|
||||||
memcpy( ret, tmp+i, sizeof(tr_peer*) * (retCount-i) );
|
memcpy( ret, tmp+i, sizeof(tr_peer*) * (retCount-i) );
|
||||||
memcpy( ret+(retCount-i), tmp, sizeof(tr_peer*) * i );
|
memcpy( ret+(retCount-i), tmp, sizeof(tr_peer*) * i );
|
||||||
|
@ -1651,7 +1651,7 @@ rechoke( Torrent * t )
|
||||||
|
|
||||||
if(( n = tr_ptrArraySize( randPool )))
|
if(( n = tr_ptrArraySize( randPool )))
|
||||||
{
|
{
|
||||||
c = tr_ptrArrayNth( randPool, tr_simpleRandInt( n ));
|
c = tr_ptrArrayNth( randPool, tr_stupidRandInt( n ));
|
||||||
c->doUnchoke = 1;
|
c->doUnchoke = 1;
|
||||||
t->optimistic = c->peer;
|
t->optimistic = c->peer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue