]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #4047 "transfer speed shown as 0" -- revert r11783 (#3950) because it...
authorJordan Lee <jordan@transmissionbt.com>
Tue, 1 Mar 2011 15:23:13 +0000 (15:23 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Tue, 1 Mar 2011 15:23:13 +0000 (15:23 +0000)
libtransmission/peer-io.c
libtransmission/peer-mgr.c
libtransmission/session.c
libtransmission/session.h

index 155c09064c683798393e1155265d087215840fb4..9e6be14b9119b4f916a142db66060a66d786906d 100644 (file)
@@ -108,7 +108,7 @@ didWriteWrapper( tr_peerIo * io, unsigned int bytes_transferred )
         /* For uTP sockets, the overhead is computed in utp_on_overhead. */
         const unsigned int overhead =
             io->socket ? guessPacketOverhead( payload ) : 0;
-        const uint64_t now = tr_sessionGetTimeMsec( io->session );
+        const uint64_t now = tr_time_msec( );
 
         tr_bandwidthUsed( &io->bandwidth, TR_UP, payload, next->isPieceData, now );
 
@@ -148,7 +148,7 @@ canReadWrapper( tr_peerIo * io )
     /* try to consume the input buffer */
     if( io->canRead )
     {
-        const uint64_t now = tr_sessionGetTimeMsec( io->session );
+        const uint64_t now = tr_time_msec( );
 
         tr_sessionLock( session );
 
index 7d8e1ba0b6e9ac2236b8ae6d04066d6525addf12..df2156a7fb89f9812dcd27c97e6bf93697645189 100644 (file)
@@ -3100,7 +3100,7 @@ rechokePulse( int foo UNUSED, short bar UNUSED, void * vmgr )
 {
     tr_torrent * tor = NULL;
     tr_peerMgr * mgr = vmgr;
-    const uint64_t now = tr_sessionGetTimeMsec( mgr->session );
+    const uint64_t now = tr_time_msec( );
 
     managerLock( mgr );
 
@@ -3431,7 +3431,7 @@ reconnectPulse( int foo UNUSED, short bar UNUSED, void * vmgr )
     tr_torrent * tor;
     tr_peerMgr * mgr = vmgr;
     const time_t now_sec = tr_time( );
-    const uint64_t now_msec = tr_sessionGetTimeMsec( mgr->session );
+    const uint64_t now_msec = tr_time_msec( );
 
     /**
     ***  enforce the per-session and per-torrent peer limits
index e729f5f8b834374a0fc2004a4ede1dd18f732c3a..bdc04251a4cab523ae6e1168949305975a5f40ce 100644 (file)
@@ -2610,36 +2610,3 @@ tr_sessionSetWebConfigFunc( tr_session * session, void (*func)(tr_session*, void
 {
     session->curl_easy_config_func = func;
 }
-
-/***
-****
-***/
-
-uint64_t
-tr_sessionGetTimeMsec( tr_session * session )
-{
-    struct timeval tv;
-
-    if( event_base_gettimeofday_cached( session->event_base, &tv ) )
-    {
-        return tr_time_msec( );
-    }
-    else
-    {
-        /* event_base_gettimeofday_cached() might be implemented using
-           clock_gettime(CLOCK_MONOTONIC), so calculate the offset to
-           real time... */
-        static uint64_t offset;
-        static tr_bool offset_calculated = FALSE;
-
-        const uint64_t val = (uint64_t) tv.tv_sec * 1000 + ( tv.tv_usec / 1000 );
-
-        if( !offset_calculated )
-        {
-            offset = tr_time_msec() - val;
-            offset_calculated = TRUE;
-        }
-
-        return val + offset;
-    }
-}
index d8ab9c1ebad2f21f947d4a298ca3b8fdcdf35b8a..5a95df06471284ecfc6ea490be8c0436704d4b67 100644 (file)
@@ -306,15 +306,4 @@ tr_bool  tr_sessionGetActiveSpeedLimit_Bps( const tr_session  * session,
                                             tr_direction        dir,
                                             int               * setme );
 
-
-/**
- * Tries to use libevent's cached timeval so we can avoid excessive calls
- * to gettimeofday().
- *
- * This isn't for all uses, but should be reasonably accurate when called
- * near the beginning of a libevent callback.
- */
-uint64_t tr_sessionGetTimeMsec( tr_session * session );
-
-
 #endif