Changeset 11980


Ignore:
Timestamp:
Feb 19, 2011, 12:24:00 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) closeBadPeers() part 1 of 2: don't bother sorting these peers by activity -- we're closing -all- of them, so sorting them is pointless.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r11969 r11980  
    31623162}
    31633163
    3164 static void sortPeersByLivelinessReverse( tr_peer ** peers, void ** clientData, int n, uint64_t now );
    3165 
    31663164static tr_peer **
    31673165getPeersToClose( Torrent * t, tr_close_type_t closeType,
    3168                  const uint64_t now_msec, const time_t now_sec,
     3166                 const time_t now_sec,
    31693167                 int * setmeSize )
    31703168{
     
    31783176        if( shouldPeerBeClosed( t, peers[i], peerCount, now_sec ) == closeType )
    31793177            ret[outsize++] = peers[i];
    3180 
    3181     sortPeersByLivelinessReverse ( ret, NULL, outsize, now_msec );
    31823178
    31833179    *setmeSize = outsize;
     
    32733269
    32743270static void
    3275 closeBadPeers( Torrent * t, const uint64_t now_msec, const time_t now_sec )
     3271closeBadPeers( Torrent * t, const time_t now_sec )
    32763272{
    32773273    if( !t->isRunning )
     
    32863282
    32873283        /* disconnect the really bad peers */
    3288         mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_msec, now_sec, &mustCloseCount );
     3284        mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_sec, &mustCloseCount );
    32893285        for( i=0; i<mustCloseCount; ++i )
    32903286            closePeer( t, mustClose[i] );
     
    33243320
    33253321    return 0;
    3326 }
    3327 
    3328 static int
    3329 comparePeerLivelinessReverse( const void * va, const void * vb )
    3330 {
    3331     return -comparePeerLiveliness (va, vb);
    33323322}
    33333323
     
    33773367{
    33783368    sortPeersByLivelinessImpl( peers, clientData, n, now, comparePeerLiveliness );
    3379 }
    3380 
    3381 static void
    3382 sortPeersByLivelinessReverse( tr_peer ** peers, void ** clientData, int n, uint64_t now )
    3383 {
    3384     sortPeersByLivelinessImpl( peers, clientData, n, now, comparePeerLivelinessReverse );
    33853369}
    33863370
     
    34713455    tor = NULL;
    34723456    while(( tor = tr_torrentNext( mgr->session, tor )))
    3473         closeBadPeers( tor->torrentPeers, now_msec, now_sec );
     3457        closeBadPeers( tor->torrentPeers, now_sec );
    34743458
    34753459    /* try to make new peer connections */
Note: See TracChangeset for help on using the changeset viewer.