diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index 814e3862a..6520a1880 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -338,7 +338,6 @@ peerConstructor( struct peer_atom * atom ) tr_bitsetConstructor( &peer->have, 0 ); peer->atom = atom; atom->peer = peer; - peer->atom = atom; return peer; } diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 4f0b5bf38..6aad0c0c0 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -496,45 +496,6 @@ tr_torrentPromoteTracker( tr_torrent * tor, return i; } -struct RandomTracker -{ - tr_tracker_info tracker; - int random_value; -}; - -/* the tiers will be sorted from lowest to highest, - * and trackers are randomized within the tiers */ -static TR_INLINE int -compareRandomTracker( const void * va, - const void * vb ) -{ - const struct RandomTracker * a = va; - const struct RandomTracker * b = vb; - - if( a->tracker.tier != b->tracker.tier ) - return a->tracker.tier - b->tracker.tier; - - return a->random_value - b->random_value; -} - -static void -randomizeTiers( tr_info * info ) -{ - int i; - const int n = info->trackerCount; - struct RandomTracker * r = tr_new0( struct RandomTracker, n ); - - for( i = 0; i < n; ++i ) - { - r[i].tracker = info->trackers[i]; - r[i].random_value = tr_cryptoRandInt( INT_MAX ); - } - qsort( r, n, sizeof( struct RandomTracker ), compareRandomTracker ); - for( i = 0; i < n; ++i ) - info->trackers[i] = r[i].tracker; - tr_free( r ); -} - static void torrentStart( tr_torrent * tor ); /** @@ -641,8 +602,6 @@ torrentInit( tr_torrent * tor, const tr_ctor * ctor ) tor->uniqueId = nextUniqueId++; tor->magicNumber = TORRENT_MAGIC_NUMBER; - randomizeTiers( &tor->info ); - tr_sha1( tor->obfuscatedHash, "req2", 4, tor->info.hash, SHA_DIGEST_LENGTH, NULL );