Changeset 9709


Ignore:
Timestamp:
Dec 10, 2009, 7:04:10 PM (12 years ago)
Author:
charles
Message:

(trunk libT) new utility function tr_timerAddMsec()

Location:
trunk/libtransmission
Files:
3 edited

Legend:

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

    r9704 r9709  
    10091009}
    10101010
    1011 static void
    1012 renewTimer( struct event * timer, int msec )
    1013 {
    1014     const int seconds =  msec / 1000;
    1015     const int usec = (msec%1000) * 1000;
    1016     tr_timerAdd( timer, seconds, usec );
    1017 }
    1018 
    10191011/* cancel requests that are too old */
    10201012static void
     
    10701062    }
    10711063
    1072     renewTimer( mgr->refillUpkeepTimer, REFILL_UPKEEP_PERIOD_MSEC );
     1064    tr_timerAddMsec( mgr->refillUpkeepTimer, REFILL_UPKEEP_PERIOD_MSEC );
    10731065    managerUnlock( mgr );
    10741066}
     
    18571849    struct event * timer = tr_new0( struct event, 1 );
    18581850    evtimer_set( timer, callback, cbdata );
    1859     renewTimer( timer, msec );
     1851    tr_timerAddMsec( timer, msec );
    18601852    return timer;
    18611853}
     
    23472339            rechokeTorrent( tor->torrentPeers, now );
    23482340
    2349     renewTimer( mgr->rechokeTimer, RECHOKE_PERIOD_MSEC );
     2341    tr_timerAddMsec( mgr->rechokeTimer, RECHOKE_PERIOD_MSEC );
    23502342    managerUnlock( mgr );
    23512343}
     
    29022894            reconnectTorrent( tor->torrentPeers );
    29032895
    2904     renewTimer( mgr->reconnectTimer, RECONNECT_PERIOD_MSEC );
     2896    tr_timerAddMsec( mgr->reconnectTimer, RECONNECT_PERIOD_MSEC );
    29052897    managerUnlock( mgr );
    29062898}
     
    29672959            tr_torrentStop( tor );
    29682960
    2969     renewTimer( mgr->bandwidthTimer, BANDWIDTH_PERIOD_MSEC );
     2961    tr_timerAddMsec( mgr->bandwidthTimer, BANDWIDTH_PERIOD_MSEC );
    29702962    managerUnlock( mgr );
    29712963}
     
    30863078    }
    30873079
    3088     renewTimer( mgr->atomTimer, ATOM_PERIOD_MSEC );
     3080    tr_timerAddMsec( mgr->atomTimer, ATOM_PERIOD_MSEC );
    30893081    managerUnlock( mgr );
    30903082}
  • trunk/libtransmission/utils.c

    r9705 r9709  
    498498    tr_timevalSet( &tv, seconds, microseconds );
    499499    event_add( timer, &tv );
     500}
     501
     502void
     503tr_timerAddMsec( struct event * timer, int msec )
     504{
     505    const int seconds =  msec / 1000;
     506    const int usec = (msec%1000) * 1000;
     507    tr_timerAdd( timer, seconds, usec );
    500508}
    501509
  • trunk/libtransmission/utils.h

    r9671 r9709  
    266266void tr_timerAdd( struct event * timer, int seconds, int microseconds );
    267267
     268void tr_timerAddMsec( struct event * timer, int milliseconds );
     269
    268270
    269271/** @brief return the current date in milliseconds */
Note: See TracChangeset for help on using the changeset viewer.