fix another crash-on-shutdown in the new web code
This commit is contained in:
parent
b9c27b23d5
commit
1dfc98fc77
|
@ -385,18 +385,14 @@ tr_torrentCount( const tr_handle * h )
|
|||
}
|
||||
|
||||
static void
|
||||
tr_closeImpl( void * vh )
|
||||
tr_closeAllConnections( void * vh )
|
||||
{
|
||||
tr_handle * h = vh;
|
||||
tr_torrent * t;
|
||||
|
||||
tr_webClose( h->web );
|
||||
tr_sharedShuttingDown( h->shared );
|
||||
tr_trackerShuttingDown( h );
|
||||
|
||||
_tr_blocklistFree( h->blocklist );
|
||||
h->blocklist = NULL;
|
||||
|
||||
for( t=h->torrentList; t!=NULL; ) {
|
||||
tr_torrent * tmp = t;
|
||||
t = t->next;
|
||||
|
@ -428,10 +424,14 @@ tr_close( tr_handle * h )
|
|||
|
||||
tr_statsClose( h );
|
||||
|
||||
tr_runInEventThread( h, tr_closeImpl, h );
|
||||
tr_runInEventThread( h, tr_closeAllConnections, h );
|
||||
while( !h->isClosed && !deadlineReached( deadline ) )
|
||||
tr_wait( 100 );
|
||||
|
||||
_tr_blocklistFree( h->blocklist );
|
||||
h->blocklist = NULL;
|
||||
tr_webClose( &h->web );
|
||||
|
||||
tr_eventClose( h );
|
||||
while( h->events && !deadlineReached( deadline ) )
|
||||
tr_wait( 100 );
|
||||
|
|
|
@ -319,12 +319,13 @@ tr_webInit( tr_session * session )
|
|||
}
|
||||
|
||||
void
|
||||
tr_webClose( tr_web * web )
|
||||
tr_webClose( tr_web ** web )
|
||||
{
|
||||
dbgmsg( "deleting web->timer" );
|
||||
evtimer_del( &web->timer );
|
||||
curl_multi_cleanup( web->cm );
|
||||
tr_free( web );
|
||||
evtimer_del( &(*web)->timer );
|
||||
curl_multi_cleanup( (*web)->cm );
|
||||
tr_free( *web );
|
||||
*web = NULL;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -18,7 +18,7 @@ typedef struct tr_web tr_web;
|
|||
|
||||
tr_web* tr_webInit( tr_handle * session );
|
||||
|
||||
void tr_webClose( tr_web * );
|
||||
void tr_webClose( tr_web ** );
|
||||
|
||||
typedef void (tr_web_done_func)( tr_handle * session,
|
||||
long response_code,
|
||||
|
|
Loading…
Reference in New Issue