Changeset 7288
- Timestamp:
- Dec 5, 2008, 6:00:53 PM (12 years ago)
- Location:
- branches/1.3x/libtransmission
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3x/libtransmission/fdlimit.c
r6489 r7288 60 60 #endif 61 61 62 #define dbgmsg(fmt...) tr_deepLog( __FILE__, __LINE__, NULL, ##fmt ) 62 #define dbgmsg( ... ) \ 63 do { \ 64 if( tr_deepLoggingIsActive( ) ) \ 65 tr_deepLog( __FILE__, __LINE__, NULL, __VA_ARGS__ ); \ 66 } while( 0 ) 63 67 64 68 /** -
branches/1.3x/libtransmission/handshake.c
r7287 r7288 135 135 **/ 136 136 137 #define dbgmsg(handshake, fmt...) tr_deepLog( __FILE__, __LINE__, tr_peerIoGetAddrStr( handshake->io ), ##fmt ) 137 #define dbgmsg( handshake, ... ) \ 138 do { \ 139 if( tr_deepLoggingIsActive( ) ) \ 140 tr_deepLog( __FILE__, __LINE__, tr_peerIoGetAddrStr( handshake->io ), __VA_ARGS__ ); \ 141 } while( 0 ) 138 142 139 143 static const char* getStateName( short state ) -
branches/1.3x/libtransmission/peer-mgr.c
r7285 r7288 128 128 }; 129 129 130 #define tordbg(t, fmt...) tr_deepLog( __FILE__, __LINE__, t->tor->info.name, ##fmt ) 130 #define tordbg( t, ... ) \ 131 do { \ 132 if( tr_deepLoggingIsActive( ) ) \ 133 tr_deepLog( __FILE__, __LINE__, t->tor->info.name, __VA_ARGS__ ); \ 134 } while( 0 ) 131 135 132 136 /** -
branches/1.3x/libtransmission/peer-msgs.c
r7284 r7288 588 588 tr_peerMsgsSetChoke( tr_peermsgs * msgs, int choke ) 589 589 { 590 const time_t fibrillationTime = time(NULL) - MIN_CHOKE_PERIOD_SEC; 590 const time_t now = time( NULL ); 591 const time_t fibrillationTime = now - MIN_CHOKE_PERIOD_SEC; 591 592 592 593 assert( msgs ); … … 604 605 cancelAllRequestsToClientExceptFast( msgs ); 605 606 protocolSendChoke( msgs, choke ); 606 msgs->info->chokeChangedAt = time( NULL );607 msgs->info->chokeChangedAt = now; 607 608 } 608 609 } … … 780 781 781 782 static void 782 expireOldRequests( tr_peermsgs * msgs )783 expireOldRequests( tr_peermsgs * msgs, const time_t now ) 783 784 { 784 785 int i; … … 787 788 788 789 /* cancel requests that have been queued for too long */ 789 oldestAllowed = time( NULL )- QUEUED_REQUEST_TTL_SECS;790 oldestAllowed = now - QUEUED_REQUEST_TTL_SECS; 790 791 reqListCopy( &tmp, &msgs->clientWillAskFor ); 791 792 for( i=0; i<tmp.count; ++i ) { … … 797 798 798 799 /* cancel requests that were sent too long ago */ 799 oldestAllowed = time( NULL )- SENT_REQUEST_TTL_SECS;800 oldestAllowed = now - SENT_REQUEST_TTL_SECS; 800 801 reqListCopy( &tmp, &msgs->clientAskedFor ); 801 802 for( i=0; i<tmp.count; ++i ) { … … 808 809 809 810 static void 810 pumpRequestQueue( tr_peermsgs * msgs )811 pumpRequestQueue( tr_peermsgs * msgs, const time_t now ) 811 812 { 812 813 const int max = msgs->maxActiveRequests; 813 814 const int min = msgs->minActiveRequests; 814 const time_t now = time( NULL );815 815 int sent = 0; 816 816 int count = msgs->clientAskedFor.count; … … 1448 1448 1449 1449 static void 1450 peerGotBytes( tr_peermsgs * msgs, uint32_t byteCount )1451 { 1452 msgs->info->pieceDataActivityDate = time( NULL );1450 peerGotBytes( tr_peermsgs * msgs, uint32_t byteCount, const time_t now ) 1451 { 1452 msgs->info->pieceDataActivityDate = now; 1453 1453 tr_rcTransferred( msgs->info->rcToPeer, byteCount ); 1454 1454 firePeerGotData( msgs, byteCount ); … … 1660 1660 1661 1661 tr_peerIoTryRead( msgs->io ); 1662 pumpRequestQueue( msgs );1663 expireOldRequests( msgs );1662 pumpRequestQueue( msgs, now ); 1663 expireOldRequests( msgs, now ); 1664 1664 1665 1665 if( msgs->sendingBlock ) … … 1675 1675 tr_peerIoWrite( msgs->io, EVBUFFER_DATA( msgs->outBlock ), outlen ); 1676 1676 evbuffer_drain( msgs->outBlock, outlen ); 1677 peerGotBytes( msgs, outlen );1677 peerGotBytes( msgs, outlen, now ); 1678 1678 1679 1679 len -= outlen; -
branches/1.3x/libtransmission/rpc-server.c
r6585 r7288 51 51 }; 52 52 53 #define dbgmsg(fmt...) tr_deepLog(__FILE__, __LINE__, MY_NAME, ##fmt ) 53 #define dbgmsg( ... ) \ 54 do { \ 55 if( tr_deepLoggingIsActive( ) ) \ 56 tr_deepLog( __FILE__, __LINE__, MY_NAME, __VA_ARGS__ ); \ 57 } while( 0 ) 54 58 55 59 static const char* -
branches/1.3x/libtransmission/session.c
r6425 r7288 534 534 #define SHUTDOWN_MAX_SECONDS 30 535 535 536 #define dbgmsg(fmt...) tr_deepLog( __FILE__, __LINE__, NULL, ##fmt ) 536 #define dbgmsg( ... ) \ 537 do { \ 538 if( tr_deepLoggingIsActive( ) ) \ 539 tr_deepLog( __FILE__, __LINE__, NULL, __VA_ARGS__ ); \ 540 } while( 0 ) 537 541 538 542 void -
branches/1.3x/libtransmission/tracker.c
r7282 r7288 116 116 }; 117 117 118 #define dbgmsg(name, fmt...) tr_deepLog(__FILE__, __LINE__, name, ##fmt ) 118 #define dbgmsg( name, ... ) \ 119 do { \ 120 if( tr_deepLoggingIsActive( ) ) \ 121 tr_deepLog( __FILE__, __LINE__, name, __VA_ARGS__ ); \ 122 } while( 0 ) 119 123 120 124 /*** -
branches/1.3x/libtransmission/trevent.c
r6253 r7288 67 67 }; 68 68 69 #define dbgmsg(fmt...) tr_deepLog( __FILE__, __LINE__, "event", ##fmt ) 69 #define dbgmsg( ... ) \ 70 do { \ 71 if( tr_deepLoggingIsActive( ) ) \ 72 tr_deepLog( __FILE__, __LINE__, "event", __VA_ARGS__ ); \ 73 } while( 0 ) 70 74 71 75 static void -
branches/1.3x/libtransmission/utils.c
r6768 r7288 173 173 } 174 174 175 int 176 tr_deepLoggingIsActive( void ) 177 { 178 return tr_getLog != NULL; 179 } 180 175 181 void 176 182 tr_deepLog( const char * file, int line, const char * name, const char * fmt, ... ) -
branches/1.3x/libtransmission/utils.h
r6768 r7288 111 111 112 112 FILE* tr_getLog( void ); 113 114 int tr_deepLoggingIsActive( void ); 113 115 114 116 void tr_deepLog( const char * file, int line, -
branches/1.3x/libtransmission/web.c
r6447 r7288 30 30 #define PULSE_MSEC 500 31 31 32 #define dbgmsg(fmt...) tr_deepLog( __FILE__, __LINE__, "web", ##fmt ) 32 #define dbgmsg( ... ) \ 33 do { \ 34 if( tr_deepLoggingIsActive( ) ) \ 35 tr_deepLog( __FILE__, __LINE__, "web", __VA_ARGS__ ); \ 36 } while( 0 ) 33 37 34 38 struct tr_web
Note: See TracChangeset
for help on using the changeset viewer.