Changeset 12060 for branches


Ignore:
Timestamp:
Mar 1, 2011, 3:23:22 PM (11 years ago)
Author:
jordan
Message:

(trunk 2.2x) #4047 "transfer speed shown as 0" -- revert r11783 (#3950) because it caused speed misreporting.

Location:
branches/2.2x/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2x/libtransmission/peer-io.c

    r12023 r12060  
    101101        const unsigned int payload = MIN( next->length, bytes_transferred );
    102102        const unsigned int overhead = guessPacketOverhead( payload );
    103         const uint64_t now = tr_sessionGetTimeMsec( io->session );
     103        const uint64_t now = tr_time_msec( );
    104104
    105105        tr_bandwidthUsed( &io->bandwidth, TR_UP, payload, next->isPieceData, now );
     
    141141    if( io->canRead )
    142142    {
    143         const uint64_t now = tr_sessionGetTimeMsec( io->session );
     143        const uint64_t now = tr_time_msec( );
    144144
    145145        tr_sessionLock( session );
  • branches/2.2x/libtransmission/peer-mgr.c

    r12035 r12060  
    28502850    tr_torrent * tor = NULL;
    28512851    tr_peerMgr * mgr = vmgr;
    2852     const uint64_t now = tr_sessionGetTimeMsec( mgr->session );
     2852    const uint64_t now = tr_time_msec( );
    28532853
    28542854    managerLock( mgr );
     
    31753175    tr_peerMgr * mgr = vmgr;
    31763176    const time_t now_sec = tr_time( );
    3177     const uint64_t now_msec = tr_sessionGetTimeMsec( mgr->session );
     3177    const uint64_t now_msec = tr_time_msec( );
    31783178
    31793179    /**
  • branches/2.2x/libtransmission/session.c

    r11800 r12060  
    25642564    session->curl_easy_config_func = func;
    25652565}
    2566 
    2567 /***
    2568 ****
    2569 ***/
    2570 
    2571 uint64_t
    2572 tr_sessionGetTimeMsec( tr_session * session )
    2573 {
    2574     struct timeval tv;
    2575 
    2576     if( event_base_gettimeofday_cached( session->event_base, &tv ) )
    2577     {
    2578         return tr_time_msec( );
    2579     }
    2580     else
    2581     {
    2582         /* event_base_gettimeofday_cached() might be implemented using
    2583            clock_gettime(CLOCK_MONOTONIC), so calculate the offset to
    2584            real time... */
    2585         static uint64_t offset;
    2586         static tr_bool offset_calculated = FALSE;
    2587 
    2588         const uint64_t val = (uint64_t) tv.tv_sec * 1000 + ( tv.tv_usec / 1000 );
    2589 
    2590         if( !offset_calculated )
    2591         {
    2592             offset = tr_time_msec() - val;
    2593             offset_calculated = TRUE;
    2594         }
    2595 
    2596         return val + offset;
    2597     }
    2598 }
  • branches/2.2x/libtransmission/session.h

    r11800 r12060  
    306306                                            int               * setme );
    307307
    308 
    309 /**
    310  * Tries to use libevent's cached timeval so we can avoid excessive calls
    311  * to gettimeofday().
    312  *
    313  * This isn't for all uses, but should be reasonably accurate when called
    314  * near the beginning of a libevent callback.
    315  */
    316 uint64_t tr_sessionGetTimeMsec( tr_session * session );
    317 
    318 
    319308#endif
Note: See TracChangeset for help on using the changeset viewer.