Changeset 12426


Ignore:
Timestamp:
May 10, 2011, 2:41:59 PM (10 years ago)
Author:
jordan
Message:

(trunk libT) minor CPU improvement to peer-mgr.c's bandwidthPulse()

We looped through all the torrents 3x to do three separate tasks... instead, loop only once and do the three tasks inside the single loop.

File:
1 edited

Legend:

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

    r12425 r12426  
    35573557    tr_bandwidthAllocate( &mgr->session->bandwidth, TR_DOWN, BANDWIDTH_PERIOD_MSEC );
    35583558
    3559     /* possibly stop torrents that have seeded enough */
     3559    /* torrent upkeep */
    35603560    tor = NULL;
    35613561    while(( tor = tr_torrentNext( mgr->session, tor )))
     3562    {
     3563        /* possibly stop torrents that have seeded enough */
    35623564        tr_torrentCheckSeedLimit( tor );
    35633565
    3564     /* run the completeness check for any torrents that need it */
    3565     tor = NULL;
    3566     while(( tor = tr_torrentNext( mgr->session, tor ))) {
     3566        /* run the completeness check for any torrents that need it */
    35673567        if( tor->torrentPeers->needsCompletenessCheck ) {
    35683568            tor->torrentPeers->needsCompletenessCheck  = false;
    35693569            tr_torrentRecheckCompleteness( tor );
    35703570        }
    3571     }
    3572 
    3573     /* stop torrents that are ready to stop, but couldn't be stopped earlier
    3574      * during the peer-io callback call chain */
    3575     tor = NULL;
    3576     while(( tor = tr_torrentNext( mgr->session, tor )))
     3571
     3572        /* stop torrents that are ready to stop, but couldn't be stopped
     3573           earlier during the peer-io callback call chain */
    35773574        if( tor->isStopping )
    35783575            tr_torrentStop( tor );
     3576    }
    35793577
    35803578    reconnectPulse( 0, 0, mgr );
Note: See TracChangeset for help on using the changeset viewer.