Changeset 3337


Ignore:
Timestamp:
Oct 9, 2007, 4:50:10 AM (15 years ago)
Author:
charles
Message:

fix recent tracker error reported by John_Clay that made it slower to pick up peers

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3322 r3337  
    16121612        const int peerCount = tr_ptrArraySize( t->peers );
    16131613
    1614         tordbg( t, "RECONNECT pulse for [%s]: %d weak connections, %d connection candidates, %d atoms, max per pulse is %d",
    1615                  t->tor->info.name, nWeak, nCandidates, tr_ptrArraySize(t->pool), (int)MAX_RECONNECTIONS_PER_PULSE );
     1614        if( nWeak || nCandidates )
     1615            tordbg( t, "reconnect pulse for [%s]: %d weak connections, "
     1616                       "%d connection candidates, %d atoms, max per pulse is %d",
     1617                       t->tor->info.name, nWeak, nCandidates,
     1618                       tr_ptrArraySize(t->pool),
     1619                       (int)MAX_RECONNECTIONS_PER_PULSE );
    16161620
    16171621        /* disconnect some peers */
  • trunk/libtransmission/tracker.c

    r3336 r3337  
    4949#define STOPPING_TIMEOUT_INTERVAL_SEC 8
    5050
    51 /* the value of the 'numwant' argument passed in tracker requests */
    52 #define NUMWANT 128
     51/* the value of the 'numwant' argument passed in tracker requests.
     52 * this should be big, but if it's *too* big trackers will ignore it */
     53#define NUMWANT 50
    5354
    5455/* the length of the 'key' argument passed in tracker requests */
     
    745746                        const char        * eventName )
    746747{
    747     const int stopping = !strcmp( eventName, "stopped" );
    748     const int numwant = stopping ? 0 : NUMWANT;
     748    const int isStopping = !strcmp( eventName, "stopped" );
     749    const int numwant = isStopping ? 0 : NUMWANT;
    749750    char buf[4096];
    750751
     
    976977{
    977978    Torrent * t = (Torrent *) vt;
     979    const int isStopping = eventName && !strcmp( eventName, "stopped" );
    978980    const tr_tracker_info * address = getCurrentAddress( t->tracker );
    979981    char * uri;
     
    10041006        tr_free( t->lastRequest );
    10051007        t->lastRequest = tr_strdup( eventName );
    1006         if( !eventName || !strcmp( eventName, "stopped" ) ) {
     1008        if( isStopping ) {
     1009            evhttp_connection_set_timeout( evcon, STOPPING_TIMEOUT_INTERVAL_SEC );
     1010            httpReq = evhttp_request_new( onStoppedResponse, t->tracker->handle );
     1011        } else {
    10071012            evhttp_connection_set_timeout( evcon, TIMEOUT_INTERVAL_SEC );
    10081013            httpReq = evhttp_request_new( onTrackerResponse, onTrackerResponseDataNew(t) );
    1009         } else {
    1010             evhttp_connection_set_timeout( evcon, STOPPING_TIMEOUT_INTERVAL_SEC );
    1011             httpReq = evhttp_request_new( onStoppedResponse, t->tracker->handle );
    10121014        }
    10131015        addCommonHeaders( t->tracker, httpReq );
Note: See TracChangeset for help on using the changeset viewer.