Changeset 6251


Ignore:
Timestamp:
Jun 24, 2008, 9:39:07 PM (13 years ago)
Author:
charles
Message:

when getting 5xx errors from a tracker, keep increasing the intervals between retries, instead of hammering the tracker at constant intervals. thanks to mape for this suggestion.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc-server.c

    r6222 r6251  
    3232
    3333#define BUSY_INTERVAL_MSEC 30
    34 #define IDLE_INTERVAL_MSEC 100
    35 #define UNUSED_INTERVAL_MSEC 1000
     34#define IDLE_INTERVAL_MSEC 66
     35#define UNUSED_INTERVAL_MSEC 100
    3636
    3737struct tr_rpc_server
     
    143143        char ports[128];
    144144        char passwd[MAX_PATH_LENGTH];
     145        char clutchDir[MAX_PATH_LENGTH];
     146        char * clutchAlias;
    145147        struct timeval tv = tr_timevalMsec( UNUSED_INTERVAL_MSEC );
     148
     149        tr_buildPath( clutchDir, sizeof( clutchDir ), tr_sessionGetConfigDir( server->session ), "clutch", NULL );
     150        clutchAlias = tr_strdup_printf( "%s=%s", "/transmission/clutch", clutchDir );
    146151
    147152        getPasswordFile( server, passwd, sizeof( passwd ) );
     
    154159        snprintf( ports, sizeof( ports ), "%d", server->port );
    155160        shttpd_register_uri( server->ctx, "/transmission/rpc", handle_rpc, server );
     161        shttpd_set_option(server->ctx, "aliases", clutchAlias );
    156162        shttpd_set_option( server->ctx, "ports", ports );
    157163        shttpd_set_option( server->ctx, "dir_list", "0" );
    158         shttpd_set_option( server->ctx, "root", "/dev/null" );
     164        //shttpd_set_option( server->ctx, "root", "/dev/null" );
    159165        shttpd_set_option( server->ctx, "auth_realm", MY_REALM );
    160166        if( server->acl ) {
     
    170176        evtimer_set( &server->timer, rpcPulse, server );
    171177        evtimer_add( &server->timer, &tv );
     178
     179        tr_free( clutchAlias );
    172180    }
    173181}
  • trunk/libtransmission/tracker.c

    r6073 r6251  
    4545    DEFAULT_ANNOUNCE_MIN_INTERVAL_SEC = (60 * 2),
    4646
     47    /* how long to wait before a rescrape the first time we get an error */
     48    FIRST_SCRAPE_RETRY_INTERVAL_SEC = 30,
     49
     50    /* how long to wait before a reannounce the first time we get an error */
     51    FIRST_ANNOUNCE_RETRY_INTERVAL_SEC = 30,
     52
    4753    /* the value of the 'numwant' argument passed in tracker requests. */
    4854    NUMWANT = 80,
     
    7278    int scrapeIntervalSec;
    7379    int retryScrapeIntervalSec;
     80    int retryAnnounceIntervalSec;
    7481
    7582    /* index into the torrent's tr_info.trackers array */
     
    326333
    327334            success = TRUE;
     335            t->retryAnnounceIntervalSec = FIRST_SCRAPE_RETRY_INTERVAL_SEC;
    328336
    329337            if(( tr_bencDictFindStr( &benc, "failure reason", &str ))) {
     
    419427         * try again. */
    420428        t->manualAnnounceAllowedAt = ~(time_t)0;
    421         t->reannounceAt = time( NULL ) + 60;
     429        t->reannounceAt = time( NULL ) + t->retryAnnounceIntervalSec;
     430        t->retryAnnounceIntervalSec *= 2;
    422431    }
    423432    else
     
    483492                        t->scrapeIntervalSec = i;
    484493
    485                 success = TRUE;
    486 
    487494                tr_ndbg( t->name, "Scrape successful.  Rescraping in %d seconds.",
    488495                         t->scrapeIntervalSec );
    489496
    490                 t->retryScrapeIntervalSec = 30;
     497                success = TRUE;
     498                t->retryScrapeIntervalSec = FIRST_SCRAPE_RETRY_INTERVAL_SEC;
    491499            }
    492500        }
     
    838846    t->session                  = torrent->handle;
    839847    t->scrapeIntervalSec        = DEFAULT_SCRAPE_INTERVAL_SEC;
    840     t->retryScrapeIntervalSec   = 60;
     848    t->retryScrapeIntervalSec   = FIRST_SCRAPE_RETRY_INTERVAL_SEC;
     849    t->retryAnnounceIntervalSec = FIRST_ANNOUNCE_RETRY_INTERVAL_SEC;
    841850    t->announceIntervalSec      = DEFAULT_ANNOUNCE_INTERVAL_SEC;
    842851    t->announceMinIntervalSec   = DEFAULT_ANNOUNCE_MIN_INTERVAL_SEC;
Note: See TracChangeset for help on using the changeset viewer.