1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 07:33:02 +00:00

throw away all pending `scrape' requests on shutdown... we don't need them then, so they just slow us down

This commit is contained in:
Charles Kerr 2007-11-29 02:31:21 +00:00
parent aa9b21386e
commit f9670dc7ac
3 changed files with 24 additions and 6 deletions

View file

@ -620,12 +620,11 @@ struct tr_tracker_request
};
static void
freeRequest( struct tr_tracker_request ** req )
freeRequest( struct tr_tracker_request * req )
{
tr_free( (*req)->address );
tr_free( (*req)->uri );
tr_free( (*req) );
*req = NULL;
tr_free( req->address );
tr_free( req->uri );
tr_free( req );
}
static void
@ -752,6 +751,20 @@ ensureGlobalsExist( tr_handle * handle )
}
}
static void
freeRequest2( void * req )
{
freeRequest( req );
}
void
tr_trackerShuttingDown( tr_handle * handle )
{
/* since we're shutting down, we don't need to scrape anymore... */
if( handle->tracker )
tr_list_free( &handle->tracker->scrapeQueue, freeRequest2 );
}
static int
maybeFreeGlobals( tr_handle * handle )
{
@ -823,7 +836,7 @@ invokeNextInQueue( tr_handle * handle, tr_list ** list )
{
struct tr_tracker_request * req = tr_list_pop_front( list );
invokeRequest( handle, req );
freeRequest( &req );
freeRequest( req );
}
static int

View file

@ -27,6 +27,8 @@ tr_tracker * tr_trackerNew( const tr_torrent * );
void tr_trackerFree ( tr_tracker * );
void tr_trackerShuttingDown( tr_handle * );
/**
*** Tracker Publish / Subscribe
**/

View file

@ -42,6 +42,7 @@
#include "ratecontrol.h"
#include "shared.h"
#include "stats.h"
#include "tracker.h"
#include "trevent.h"
#include "utils.h"
@ -323,6 +324,8 @@ tr_closeImpl( void * vh )
tr_handle * h = vh;
tr_torrent * t;
tr_trackerShuttingDown( h );
for( t=h->torrentList; t!=NULL; t=t->next )
tr_torrentClose( t );