From: Karol Krenski Date: Thu, 18 Jun 2009 16:33:56 +0000 (+0000) Subject: - applied upstream X-Git-Tag: auto/th/transmission-1_72-1~1 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=2dda8469b17b2d268b132db21042c8bb7625a244;p=packages%2Ftransmission.git - applied upstream Changed files: transmission-timeval.patch -> 1.2 --- diff --git a/transmission-timeval.patch b/transmission-timeval.patch deleted file mode 100644 index 207dc2b..0000000 --- a/transmission-timeval.patch +++ /dev/null @@ -1,156 +0,0 @@ -Index: /trunk/libtransmission/utils.c -=================================================================== ---- /trunk/libtransmission/utils.c (revision 8592) -+++ /trunk/libtransmission/utils.c (revision 8681) -@@ -458,4 +458,12 @@ - **/ - -+tr_bool -+tr_isTimeval( const struct timeval * tv ) -+{ -+ return tv && ( tv->tv_sec >= 0 ) -+ && ( tv->tv_usec >= 0 ) -+ && ( tv->tv_usec < 1000000 ); -+} -+ - void - tr_timevalMsec( uint64_t milliseconds, struct timeval * setme ) -@@ -465,5 +473,19 @@ - setme->tv_sec = microseconds / 1000000; - setme->tv_usec = microseconds % 1000000; --} -+ assert( tr_isTimeval( setme ) ); -+} -+ -+void -+tr_timevalSet( struct timeval * setme, int seconds, int microseconds ) -+{ -+ setme->tv_sec = seconds; -+ setme->tv_usec = microseconds; -+ assert( tr_isTimeval( setme ) ); -+} -+ -+ -+/** -+*** -+**/ - - uint8_t * -Index: /trunk/libtransmission/utils.h -=================================================================== ---- /trunk/libtransmission/utils.h (revision 8561) -+++ /trunk/libtransmission/utils.h (revision 8681) -@@ -239,5 +239,9 @@ - struct timeval; - --void tr_timevalMsec( uint64_t milliseconds, struct timeval * setme ); -+tr_bool tr_isTimeval( const struct timeval * tv ); -+ -+void tr_timevalMsec( uint64_t milliseconds, struct timeval * setme ); -+ -+void tr_timevalSet( struct timeval * setme, int seconds, int microseconds ); - - -Index: /trunk/libtransmission/port-forwarding.c -=================================================================== ---- /trunk/libtransmission/port-forwarding.c (revision 8538) -+++ /trunk/libtransmission/port-forwarding.c (revision 8681) -@@ -109,19 +109,19 @@ - * to renew the port forwarding if it's expired */ - s->doPortCheck = TRUE; -- interval.tv_sec = 60*20; -+ tr_timevalSet( &interval, 60*20, 0 ); - break; - - case TR_PORT_ERROR: - /* some kind of an error. wait 60 seconds and retry */ -- interval.tv_sec = 60; -+ tr_timevalSet( &interval, 60, 0 ); - break; - - default: - /* in progress. pulse frequently. */ -- interval.tv_sec = 0; -- interval.tv_usec = 333000; -+ tr_timevalSet( &interval, 0, 333000 ); - break; - } - -+ assert( tr_isTimeval( &interval ) ); - evtimer_add( s->timer, &interval ); - } -@@ -144,8 +144,8 @@ - { - struct timeval timeval; -- timeval.tv_sec = 0; -- timeval.tv_usec = 333000; -+ - s->timer = tr_new0( struct event, 1 ); - evtimer_set( s->timer, onTimer, s ); -+ tr_timevalSet( &timeval, 0, 333000 ); - evtimer_add( s->timer, &timeval ); - } -Index: /trunk/libtransmission/tr-dht.c -=================================================================== ---- /trunk/libtransmission/tr-dht.c (revision 8606) -+++ /trunk/libtransmission/tr-dht.c (revision 8681) -@@ -92,7 +92,6 @@ - break; - tr_dhtAddNode(cl->session, &addr, port, 1); -- tv.tv_sec = 2 + tr_cryptoWeakRandInt( 5 ); -- tv.tv_usec = tr_cryptoWeakRandInt( 1000000 ); -- select(0, NULL, NULL, NULL, &tv); -+ tr_timevalSet( &tv, 2 + tr_cryptoWeakRandInt( 5 ), tr_cryptoWeakRandInt( 1000000 ) ); -+ select( 0, NULL, NULL, NULL, &tv ); - } - tr_free( cl->nodes ); -@@ -170,7 +169,7 @@ - } - -- tv.tv_sec = 0; -- tv.tv_usec = tr_cryptoWeakRandInt( 1000000 ); -+ tr_timevalSet( &tv, 0, tr_cryptoWeakRandInt( 1000000 ) ); - event_set( &dht_event, dht_socket, EV_READ, event_callback, NULL ); -+ assert( tr_isTimeval( &tv ) ); - event_add( &dht_event, &tv ); - -@@ -377,7 +376,6 @@ - /* Being slightly late is fine, - and has the added benefit of adding some jitter. */ -- tv.tv_sec = tosleep; -- tv.tv_usec = tr_cryptoWeakRandInt( 1000000 ); -- event_add(&dht_event, &tv); -+ tr_timevalSet( &tv, tosleep, tr_cryptoWeakRandInt( 1000000 ) ); -+ event_add( &dht_event, &tv ); - } - -Index: /trunk/libtransmission/trevent.c -=================================================================== ---- /trunk/libtransmission/trevent.c (revision 8662) -+++ /trunk/libtransmission/trevent.c (revision 8681) -@@ -304,8 +304,10 @@ - timer->inCallback = 0; - -- if( more ) -+ if( !more ) -+ tr_timerFree( &timer ); -+ else { -+ assert( tr_isTimeval( &timer->tv ) ); - evtimer_add( &timer->event, &timer->tv ); -- else -- tr_timerFree( &timer ); -+ } - } - -Index: /trunk/libtransmission/session.c -=================================================================== ---- /trunk/libtransmission/session.c (revision 8680) -+++ /trunk/libtransmission/session.c (revision 8681) -@@ -1069,6 +1069,5 @@ - - tr_localtime_r( &now, &tm ); -- tv.tv_sec = 60 - tm.tm_sec; -- tv.tv_usec = 0; -+ tr_timevalSet( &tv, 60-tm.tm_sec, 0 ); - evtimer_add( session->altTimer, &tv ); - }