Ignore:
Timestamp:
May 10, 2011, 4:46:44 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) CPU improvement in torrent.c's torrentInit()

Add the new torrent to the session's torrent list by prepending it instead of appending it. That way we don't have to walk the list in order to add it. tr_session.torrentList is an unordered list, so there's no real difference between prepending and appending.

File:
1 edited

Legend:

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

    r12423 r12424  
    28292829    const int peerCount = tr_ptrArraySize( &t->peers );
    28302830    const time_t now = tr_time( );
     2831
     2832    /* some cases where this function isn't necessary */
     2833    if( tr_torrentIsSeed( t->tor ) )
     2834        return;
     2835    if ( tr_torrentIsPieceTransferAllowed( t->tor, TR_PEER_TO_CLIENT ) )
     2836        return;
    28312837
    28322838    /* decide HOW MANY peers to be interested in */
     
    31543160        if( tor->isRunning ) {
    31553161            Torrent * t = tor->torrentPeers;
    3156             if( tr_ptrArrayEmpty( &t->peers ) )
    3157                 continue;
    3158             rechokeUploads( t, now );
    3159             if( !tr_torrentIsSeed( tor ) && tr_torrentIsPieceTransferAllowed( tor, TR_PEER_TO_CLIENT ) )
     3162            if( !tr_ptrArrayEmpty( &t->peers ) ) {
     3163                rechokeUploads( t, now );
    31603164                rechokeDownloads( t );
     3165            }
    31613166        }
    31623167    }
Note: See TracChangeset for help on using the changeset viewer.