Changeset 4735


Ignore:
Timestamp:
Jan 19, 2008, 12:28:52 AM (14 years ago)
Author:
charles
Message:

more work on "router death": stagger out tracker scrape attempts and close a loophole in the handshake code

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/handshake.c

    r4662 r4735  
    10491049    handshake->doneUserData = doneUserData;
    10501050    handshake->handle = tr_peerIoGetHandle( io );
     1051    tr_peerIoSetTimeoutSecs( io, 15 );
    10511052   
    10521053    tr_peerIoSetIOFuncs( handshake->io, canRead, NULL, gotError, handshake );
  • trunk/libtransmission/tracker.c

    r4717 r4735  
    5555
    5656    /* this is how long we'll leave a request hanging before timeout */
    57     TIMEOUT_INTERVAL_SEC = 45,
     57    TIMEOUT_INTERVAL_SEC = 30,
    5858
    5959    /* this is how long we'll leave a 'stop' request hanging before timeout.
     
    115115    time_t reannounceAt;
    116116    time_t scrapeAt;
     117
     118    int randOffset;
    117119
    118120    unsigned int isRunning     : 1;
     
    617619    }
    618620
    619     t->scrapeAt = time(NULL) + nextScrapeSec;
     621    t->scrapeAt = time( NULL ) + t->randOffset + nextScrapeSec;
    620622}
    621623
     
    902904}
    903905
     906static void
     907scrapeSoon( tr_tracker * t )
     908{
     909    if( trackerSupportsScrape( t ) )
     910        t->scrapeAt = time( NULL ) + t->randOffset;
     911}
     912
    904913static int
    905914pulse( void * vhandle )
     
    10141023    t->manualAnnounceAllowedAt = ~(time_t)0;
    10151024    t->name = tr_strdup( info->name );
     1025    t->randOffset = tr_rand( 60 );
    10161026    memcpy( t->hash, info->hash, SHA_DIGEST_LENGTH );
    10171027    escape( t->escaped, info->hash, SHA_DIGEST_LENGTH );
     
    10441054    assert( iwalk - t->tierFronts == sum );
    10451055
    1046     if( trackerSupportsScrape( t ) )
    1047         enqueueScrape( t->handle, t );
     1056    scrapeSoon( t );
    10481057
    10491058    return t;
Note: See TracChangeset for help on using the changeset viewer.