Changeset 2814


Ignore:
Timestamp:
Aug 17, 2007, 3:03:28 AM (15 years ago)
Author:
charles
Message:

fix shutdown error in the new tracker code, reported by joshe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r2806 r2814  
    3131#include "utils.h"
    3232
    33 #undef tr_dbg
    34 #define tr_dbg tr_inf
    35 
    3633#define MINUTES_TO_MSEC(N) ((N) * 60 * 1000)
    3734
     
    228225tr_trackerScrapeSoon( Tracker * t )
    229226{
     227    /* don't start more than one scrape at once for the same tracker... */
     228    if( !tr_ptrArrayEmpty( t->scraping ) )
     229        return;
     230
    230231    if( !t->scrapeTag )
    231232         t->scrapeTag = tr_timerNew( onTrackerScrapeNow, t, NULL, 1000 );
     
    606607    Tracker * t = (Tracker*) vt;
    607608
    608     if( !tr_ptrArrayEmpty( t->scraping ) )
    609     {
    610         /* there's already a scrape going for this tracker...
    611            we only one one at a time, so don't do anything yet.
    612            when the current scrape is done, onScrapeResponse()
    613            will call us again. */
    614         return FALSE;
    615     }
     609    assert( !tr_ptrArrayEmpty( t->scraping ) );
    616610
    617611    if( !tr_ptrArrayEmpty( t->scrapeQueue ) )
     
    869863    }
    870864
    871     assert( tor->httpConn != NULL );
    872865    tor->httpConn = NULL;
    873866
     
    900893    if( tor->httpConn == NULL )
    901894        tor->httpConn = evhttp_connection_new( address->address,
    902                                                 address->port );
    903 
    904     tr_free( tor->lastRequest );
    905     tor->lastRequest = tr_strdup( eventName );
    906     evhttp_connection_set_timeout( tor->httpConn, REQ_TIMEOUT_INTERVAL_SEC );
    907     tor->httpReq = evhttp_request_new( onTrackerResponse, tor );
    908     addCommonHeaders( tor->tracker, tor->httpReq );
    909 
    910     evhttp_make_request( tor->httpConn, tor->httpReq, EVHTTP_REQ_GET, uri );
     895                                               address->port );
     896    if ( tor->httpConn == NULL )
     897        tr_err( "Can't make a connection to %s:%d", address->address, address->port );
     898    else {
     899        tr_free( tor->lastRequest );
     900        tor->lastRequest = tr_strdup( eventName );
     901        evhttp_connection_set_timeout( tor->httpConn, REQ_TIMEOUT_INTERVAL_SEC );
     902        tor->httpReq = evhttp_request_new( onTrackerResponse, tor );
     903        addCommonHeaders( tor->tracker, tor->httpReq );
     904        evhttp_make_request( tor->httpConn, tor->httpReq, EVHTTP_REQ_GET, uri );
     905    }
     906
    911907    tr_free( uri );
    912908
Note: See TracChangeset for help on using the changeset viewer.