Changeset 4162


Ignore:
Timestamp:
Dec 13, 2007, 9:08:05 PM (15 years ago)
Author:
charles
Message:

allocate more sockets to the tracker during shutdown to help get all the `stopped' commands done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r4152 r4162  
    258258***/
    259259
    260 static void
    261 onStoppedResponse( struct evhttp_request * req UNUSED, void * handle UNUSED )
     260static void onReqDone( tr_handle * handle );
     261
     262static void
     263onStoppedResponse( struct evhttp_request * req UNUSED, void * handle )
    262264{
    263265    dbgmsg( NULL, "got a response to some `stop' message" );
     266    onReqDone( handle );
    264267}
    265268
     
    379382    return compact;
    380383}
    381 
    382 static void onReqDone( tr_handle * handle );
    383384
    384385static void
     
    757758{
    758759    int socketCount;
     760    unsigned int isShuttingDown : 1;
    759761    tr_timer * pulseTimer;
    760762    tr_list * requestQueue;
     
    784786tr_trackerShuttingDown( tr_handle * handle )
    785787{
    786     /* since we're shutting down, we don't need to scrape anymore... */
    787788    if( handle->tracker )
     789    {
     790        /* since we're shutting down, we don't need to scrape anymore... */
    788791        tr_list_free( &handle->tracker->scrapeQueue, freeRequest2 );
     792
     793        handle->tracker->isShuttingDown = 1;
     794    }
    789795}
    790796
     
    865871socketIsAvailable( tr_handle * handle )
    866872{
    867     return handle->tracker->socketCount < MAX_TRACKER_SOCKETS;
     873    int max = MAX_TRACKER_SOCKETS;
     874    if( handle->tracker->isShuttingDown )
     875        max *= 2;
     876    return handle->tracker->socketCount < max;
    868877}
    869878
Note: See TracChangeset for help on using the changeset viewer.