Changeset 11981


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

(trunk libT) closeBadPeers() part 2 of 2: this function was serving two purposes, which wasn't clear from its name. refactor slightly to make the purpose and name match.

File:
1 edited

Legend:

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

    r11980 r11981  
    32713271closeBadPeers( Torrent * t, const time_t now_sec )
    32723272{
    3273     if( !t->isRunning )
    3274     {
    3275         removeAllPeers( t );
    3276     }
    3277     else
    3278     {
    3279         int i;
    3280         int mustCloseCount;
    3281         struct tr_peer ** mustClose;
    3282 
    3283         /* disconnect the really bad peers */
    3284         mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_sec, &mustCloseCount );
    3285         for( i=0; i<mustCloseCount; ++i )
    3286             closePeer( t, mustClose[i] );
    3287         tr_free( mustClose );
    3288     }
     3273    int i;
     3274    int mustCloseCount;
     3275    struct tr_peer ** mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_sec, &mustCloseCount );
     3276    for( i=0; i<mustCloseCount; ++i )
     3277        closePeer( t, mustClose[i] );
     3278    tr_free( mustClose );
    32893279}
    32903280
     
    34553445    tor = NULL;
    34563446    while(( tor = tr_torrentNext( mgr->session, tor )))
    3457         closeBadPeers( tor->torrentPeers, now_sec );
     3447        if( !tor->torrentPeers->isRunning )
     3448            removeAllPeers( tor->torrentPeers );
     3449        else
     3450            closeBadPeers( tor->torrentPeers, now_sec );
    34583451
    34593452    /* try to make new peer connections */
Note: See TracChangeset for help on using the changeset viewer.