(maybe) fix shutdown crash in "pulse" reported by pea_

This commit is contained in:
Charles Kerr 2007-12-13 21:48:39 +00:00
parent 6671750eda
commit 7582f4a929
1 changed files with 9 additions and 3 deletions

View File

@ -904,6 +904,9 @@ pulse( void * vhandle )
tr_torrent * tor;
const time_t now = time( NULL );
if( handle->tracker == NULL )
return FALSE;
if( handle->tracker->socketCount || tr_list_size(th->requestQueue) || tr_list_size(th->scrapeQueue) )
dbgmsg( NULL, "tracker pulse... %d sockets, %d reqs left, %d scrapes left", handle->tracker->socketCount, tr_list_size(th->requestQueue), tr_list_size(th->scrapeQueue) );
@ -941,9 +944,12 @@ pulse( void * vhandle )
static void
onReqDone( tr_handle * handle )
{
pulse( handle );
--handle->tracker->socketCount;
dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount );
if( handle->tracker )
{
pulse( handle );
--handle->tracker->socketCount;
dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount );
}
}
/***