Changeset 9530


Ignore:
Timestamp:
Nov 19, 2009, 8:31:34 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #2589: similar to r9529, just removing more redundant calls to time(NULL)

File:
1 edited

Legend:

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

    r9529 r9530  
    624624
    625625static void
    626 requestListAdd( Torrent * t, tr_block_index_t block, tr_peer * peer )
     626requestListAdd( Torrent * t, const time_t now, tr_block_index_t block, tr_peer * peer )
    627627{
    628628    struct block_request key;
     
    640640    key.block = block;
    641641    key.peer = peer;
    642     key.sentAt = time( NULL );
     642    key.sentAt = now;
    643643
    644644    /* insert the request to our array... */
     
    923923    struct weighted_piece * pieces;
    924924    const tr_bitfield * have = peer->have;
     925    const time_t now = time( NULL );
    925926
    926927    /* sanity clause */
     
    979980                /* update our own tables */
    980981                if( breq == NULL )
    981                     requestListAdd( t, b, peer );
     982                    requestListAdd( t, now, b, peer );
    982983                ++p->requestCount;
    983984            }
     
    23902391
    23912392static tr_peer **
    2392 getPeersToClose( Torrent * t, tr_close_type_t closeType, int * setmeSize )
     2393getPeersToClose( Torrent * t, tr_close_type_t closeType, const time_t now, int * setmeSize )
    23932394{
    23942395    int i, peerCount, outsize;
    23952396    tr_peer ** peers = (tr_peer**) tr_ptrArrayPeek( &t->peers, &peerCount );
    23962397    struct tr_peer ** ret = tr_new( tr_peer *, peerCount );
    2397     const time_t now = time( NULL );
    23982398
    23992399    assert( torrentIsLocked( t ) );
     
    24702470
    24712471static struct peer_atom **
    2472 getPeerCandidates( Torrent * t, int * setmeSize )
     2472getPeerCandidates( Torrent * t, const time_t now, int * setmeSize )
    24732473{
    24742474    int                 i, atomCount, retCount;
    24752475    struct peer_atom ** atoms;
    24762476    struct peer_atom ** ret;
    2477     const time_t        now = time( NULL );
    24782477    const int           seed = tr_torrentIsSeed( t->tor );
    24792478
     
    25552554    static time_t prevTime = 0;
    25562555    static int    newConnectionsThisSecond = 0;
    2557     time_t        now;
    2558 
    2559     now = time( NULL );
     2556    const time_t  now = time( NULL );
     2557
    25602558    if( prevTime != now )
    25612559    {
     
    25752573        int candidateCount;
    25762574        int maxCandidates;
    2577         struct tr_peer ** canClose = getPeersToClose( t, TR_CAN_CLOSE, &canCloseCount );
    2578         struct tr_peer ** mustClose = getPeersToClose( t, TR_MUST_CLOSE, &mustCloseCount );
    2579         struct peer_atom ** candidates = getPeerCandidates( t, &candidateCount );
     2575        struct tr_peer ** canClose = getPeersToClose( t, TR_CAN_CLOSE, now, &canCloseCount );
     2576        struct tr_peer ** mustClose = getPeersToClose( t, TR_MUST_CLOSE, now, &mustCloseCount );
     2577        struct peer_atom ** candidates = getPeerCandidates( t, now, &candidateCount );
    25802578
    25812579        tordbg( t, "reconnect pulse for [%s]: "
     
    26502648            }
    26512649
    2652             atom->time = time( NULL );
     2650            atom->time = now;
    26532651        }
    26542652
Note: See TracChangeset for help on using the changeset viewer.