Changeset 3457


Ignore:
Timestamp:
Oct 18, 2007, 6:32:58 PM (15 years ago)
Author:
charles
Message:

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.

Location:
trunk/libtransmission
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r3456 r3457  
    316316    tr_free( t->lastRequest );
    317317
     318    /* addresses... */
    318319    for( i=0; i<t->addressCount; ++i )
    319320        tr_trackerInfoClear( &t->addresses[i] );
    320 
     321    tr_free( t->addresses );
     322    tr_free( t->tierFronts );
     323
     324    /* redirect... */
    321325    if( t->redirect ) {
    322326        tr_trackerInfoClear( t->redirect );
     
    324328    }
    325329
    326     tr_free( t->addresses );
    327     tr_free( t->tierFronts );
    328330    tr_free( t );
    329331}
     
    878880
    879881    /* kill any pending requests */
     882    dbgmsg( t, "clearing announce timer" );
    880883    tr_timerFree( &t->reannounceTimer );
    881884
     
    909912{
    910913    tr_tracker * t = vt;
     914    dbgmsg( t, "onReannounce" );
    911915    sendTrackerRequest( t, "" );
     916    dbgmsg( t, "onReannounce setting announceTimer to NULL" );
    912917    t->reannounceTimer = NULL;
    913918    return FALSE;
     
    918923{
    919924    tr_tracker * t = vt;
     925    dbgmsg( t, "onRetry" );
    920926    sendTrackerRequest( t, t->lastRequest );
     927    dbgmsg( t, "onRetry setting announceTimer to NULL" );
    921928    t->reannounceTimer = NULL;
    922929    return FALSE;
  • trunk/libtransmission/trevent.c

    r3349 r3457  
    382382             timer_func         func,
    383383             void             * user_data,
    384              int                timeout_milliseconds )
     384             uint64_t           timeout_milliseconds )
    385385{
    386386    tr_timer * timer = tr_new0( tr_timer, 1 );
  • trunk/libtransmission/trevent.h

    r3247 r3457  
    1313#ifndef TR_EVENT_H
    1414
    15 #include <stddef.h> /* for size_t */
     15#include <stddef.h> /* size_t */
     16#include <inttypes.h> /* uint64_t */
    1617
    1718/**
     
    6263                       int                 func( void * user_data ),
    6364                       void              * user_data,
    64                        int                 timeout_milliseconds );
     65                       uint64_t            timeout_milliseconds );
    6566
    6667/**
  • trunk/libtransmission/utils.c

    r3448 r3457  
    398398
    399399struct timeval
    400 timevalMsec ( int milliseconds )
     400timevalMsec( uint64_t milliseconds )
    401401{
    402402    struct timeval ret;
    403     const unsigned long microseconds = milliseconds * 1000;
     403    const uint64_t microseconds = milliseconds * 1000;
    404404    ret.tv_sec  = microseconds / 1000000;
    405405    ret.tv_usec = microseconds % 1000000;
  • trunk/libtransmission/utils.h

    r3448 r3457  
    8181/* creates a filename from a series of elements using the
    8282   correct separator for filenames. */
    83 void tr_buildPath ( char* buf, size_t buflen,
    84                     const char * first_element, ... );
     83void tr_buildPath( char* buf, size_t buflen,
     84                   const char * first_element, ... );
    8585
    86 struct timeval timevalSec ( int seconds );
    87 struct timeval timevalMsec ( int milliseconds );
     86struct timeval timevalSec( int seconds );
     87struct timeval timevalMsec( uint64_t milliseconds );
    8888
    8989
Note: See TracChangeset for help on using the changeset viewer.