Ignore:
Timestamp:
Dec 5, 2007, 2:06:05 AM (15 years ago)
Author:
charles
Message:

fix tracker connection error reported by Gimp_

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r4024 r4065  
    380380}
    381381
    382 static void
    383 onTrackerResponse( struct evhttp_request * req, void * torrent_hash )
     382static void onReqDone( tr_handle * handle );
     383
     384static void
     385onTrackerResponse( struct evhttp_request * req, void * vhash )
    384386{
    385387    const char * warning;
    386     tr_tracker * t;
    387388    int responseCode;
    388 
    389     t = findTrackerFromHash( torrent_hash );
     389    struct torrent_hash * torrent_hash = (struct torrent_hash*) vhash;
     390    tr_tracker * t = findTrackerFromHash( torrent_hash );
     391
     392    onReqDone( torrent_hash->handle );
    390393    tr_free( torrent_hash );
     394
    391395    if( t == NULL ) /* tracker has been closed */
    392396        return;
     
    540544    const char * warning;
    541545    time_t nextScrapeSec = 60;
    542     tr_tracker * t = findTrackerFromHash( vhash );
     546    struct torrent_hash * torrent_hash = (struct torrent_hash*) vhash;
     547    tr_tracker * t = findTrackerFromHash( torrent_hash );
     548
     549    onReqDone( torrent_hash->handle );
     550    tr_free( torrent_hash );
    543551
    544552    dbgmsg( t, "Got scrape response for '%s': %s (%d)", (t ? t->name : "(null)"), (req ? req->response_code_line : "(no line)"), (req ? req->response_code : -1) );
    545553
    546     tr_free( vhash );
    547554    if( t == NULL ) /* tracker's been closed... */
    548555        return;
     
    818825    tr_handle * handle = vhandle;
    819826
    820     assert( handle );
    821     assert( handle->tracker );
    822 
    823827    /* libevent references evcon right after calling this function,
    824828       so we can't free it yet... defer it to after this call chain
    825829       has played out */
    826830    tr_timerNew( handle, freeConnection, evcon, 100 );
    827 
    828     --handle->tracker->socketCount;
    829     dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount );
    830     pulse( handle );
    831831}
    832832
     
    930930}
    931931
     932static void
     933onReqDone( tr_handle * handle )
     934{
     935    pulse( handle );
     936    --handle->tracker->socketCount;
     937    dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount );
     938}
     939
    932940/***
    933941****  LIFE CYCLE
Note: See TracChangeset for help on using the changeset viewer.