mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
fix overflow error that caused timers with intervals larger than 35 minutes to be lost... which is nastier than it sounds, since that's shorter than many tracker announce intervals.
This commit is contained in:
parent
6cef3fd9f9
commit
212470560e
5 changed files with 19 additions and 11 deletions
|
@ -315,16 +315,18 @@ onTrackerFreeNow( void * vt )
|
||||||
tr_free( t->trackerID );
|
tr_free( t->trackerID );
|
||||||
tr_free( t->lastRequest );
|
tr_free( t->lastRequest );
|
||||||
|
|
||||||
|
/* addresses... */
|
||||||
for( i=0; i<t->addressCount; ++i )
|
for( i=0; i<t->addressCount; ++i )
|
||||||
tr_trackerInfoClear( &t->addresses[i] );
|
tr_trackerInfoClear( &t->addresses[i] );
|
||||||
|
tr_free( t->addresses );
|
||||||
|
tr_free( t->tierFronts );
|
||||||
|
|
||||||
|
/* redirect... */
|
||||||
if( t->redirect ) {
|
if( t->redirect ) {
|
||||||
tr_trackerInfoClear( t->redirect );
|
tr_trackerInfoClear( t->redirect );
|
||||||
tr_free( t->redirect );
|
tr_free( t->redirect );
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_free( t->addresses );
|
|
||||||
tr_free( t->tierFronts );
|
|
||||||
tr_free( t );
|
tr_free( t );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,6 +879,7 @@ sendTrackerRequest( void * vt, const char * eventName )
|
||||||
uri );
|
uri );
|
||||||
|
|
||||||
/* kill any pending requests */
|
/* kill any pending requests */
|
||||||
|
dbgmsg( t, "clearing announce timer" );
|
||||||
tr_timerFree( &t->reannounceTimer );
|
tr_timerFree( &t->reannounceTimer );
|
||||||
|
|
||||||
evcon = getConnection( t, address->address, address->port );
|
evcon = getConnection( t, address->address, address->port );
|
||||||
|
@ -908,7 +911,9 @@ static int
|
||||||
onReannounce( void * vt )
|
onReannounce( void * vt )
|
||||||
{
|
{
|
||||||
tr_tracker * t = vt;
|
tr_tracker * t = vt;
|
||||||
|
dbgmsg( t, "onReannounce" );
|
||||||
sendTrackerRequest( t, "" );
|
sendTrackerRequest( t, "" );
|
||||||
|
dbgmsg( t, "onReannounce setting announceTimer to NULL" );
|
||||||
t->reannounceTimer = NULL;
|
t->reannounceTimer = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -917,7 +922,9 @@ static int
|
||||||
onRetry( void * vt )
|
onRetry( void * vt )
|
||||||
{
|
{
|
||||||
tr_tracker * t = vt;
|
tr_tracker * t = vt;
|
||||||
|
dbgmsg( t, "onRetry" );
|
||||||
sendTrackerRequest( t, t->lastRequest );
|
sendTrackerRequest( t, t->lastRequest );
|
||||||
|
dbgmsg( t, "onRetry setting announceTimer to NULL" );
|
||||||
t->reannounceTimer = NULL;
|
t->reannounceTimer = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ tr_timer*
|
||||||
tr_timerNew( struct tr_handle * handle,
|
tr_timerNew( struct tr_handle * handle,
|
||||||
timer_func func,
|
timer_func func,
|
||||||
void * user_data,
|
void * user_data,
|
||||||
int timeout_milliseconds )
|
uint64_t timeout_milliseconds )
|
||||||
{
|
{
|
||||||
tr_timer * timer = tr_new0( tr_timer, 1 );
|
tr_timer * timer = tr_new0( tr_timer, 1 );
|
||||||
timer->tv = timevalMsec( timeout_milliseconds );
|
timer->tv = timevalMsec( timeout_milliseconds );
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
#ifndef TR_EVENT_H
|
#ifndef TR_EVENT_H
|
||||||
|
|
||||||
#include <stddef.h> /* for size_t */
|
#include <stddef.h> /* size_t */
|
||||||
|
#include <inttypes.h> /* uint64_t */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
@ -61,7 +62,7 @@ typedef struct tr_timer tr_timer;
|
||||||
tr_timer* tr_timerNew( struct tr_handle * handle,
|
tr_timer* tr_timerNew( struct tr_handle * handle,
|
||||||
int func( void * user_data ),
|
int func( void * user_data ),
|
||||||
void * user_data,
|
void * user_data,
|
||||||
int timeout_milliseconds );
|
uint64_t timeout_milliseconds );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees a timer and sets the timer pointer to NULL.
|
* Frees a timer and sets the timer pointer to NULL.
|
||||||
|
|
|
@ -397,10 +397,10 @@ timevalSec ( int seconds )
|
||||||
}
|
}
|
||||||
|
|
||||||
struct timeval
|
struct timeval
|
||||||
timevalMsec ( int milliseconds )
|
timevalMsec( uint64_t milliseconds )
|
||||||
{
|
{
|
||||||
struct timeval ret;
|
struct timeval ret;
|
||||||
const unsigned long microseconds = milliseconds * 1000;
|
const uint64_t microseconds = milliseconds * 1000;
|
||||||
ret.tv_sec = microseconds / 1000000;
|
ret.tv_sec = microseconds / 1000000;
|
||||||
ret.tv_usec = microseconds % 1000000;
|
ret.tv_usec = microseconds % 1000000;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -84,7 +84,7 @@ void tr_buildPath ( char* buf, size_t buflen,
|
||||||
const char * first_element, ... );
|
const char * first_element, ... );
|
||||||
|
|
||||||
struct timeval timevalSec( int seconds );
|
struct timeval timevalSec( int seconds );
|
||||||
struct timeval timevalMsec ( int milliseconds );
|
struct timeval timevalMsec( uint64_t milliseconds );
|
||||||
|
|
||||||
|
|
||||||
int tr_ioErrorFromErrno( void );
|
int tr_ioErrorFromErrno( void );
|
||||||
|
|
Loading…
Reference in a new issue