(trunk libT) #1992: try to cleanly destroy the "verify local data" thread on shutdown

This commit is contained in:
Charles Kerr 2009-04-16 13:10:25 +00:00
parent 9d9e03fdf9
commit bee21fb545
4 changed files with 18 additions and 4 deletions

View File

@ -42,6 +42,7 @@
#include "trevent.h"
#include "utils.h"
#include "version.h"
#include "verify.h"
#include "web.h"
#define dbgmsg( ... ) \
@ -1350,6 +1351,7 @@ tr_closeAllConnections( void * vsession )
tr_free( session->altTimer );
session->altTimer = NULL;
tr_verifyClose( session );
tr_statsClose( session );
tr_sharedShuttingDown( session->shared );
tr_rpcClose( &session->rpcServer );

View File

@ -1244,7 +1244,7 @@ torrentStart( tr_torrent * tor,
if( !tor->isRunning )
{
const int isVerifying = tr_verifyInProgress( tor );
const tr_bool isVerifying = tr_verifyInProgress( tor );
if( !isVerifying && reloadProgress )
tr_torrentLoadResume( tor, TR_FR_PROGRESS, NULL );

View File

@ -269,10 +269,10 @@ compareVerifyByTorrent( const void * va,
return a->torrent - b;
}
int
tr_bool
tr_verifyInProgress( const tr_torrent * tor )
{
int found = FALSE;
tr_bool found = FALSE;
tr_lock * lock = getVerifyLock( );
tr_lockLock( lock );
@ -312,3 +312,13 @@ tr_verifyRemove( tr_torrent * tor )
tr_lockUnlock( lock );
}
void
tr_verifyClose( tr_session * session UNUSED )
{
tr_lockLock( getVerifyLock( ) );
stopCurrent = TRUE;
tr_list_free( &verifyList, tr_free );
tr_lockUnlock( getVerifyLock( ) );
}

View File

@ -24,6 +24,8 @@ void tr_verifyAdd( tr_torrent * tor,
void tr_verifyRemove( tr_torrent * tor );
int tr_verifyInProgress( const tr_torrent * tor );
tr_bool tr_verifyInProgress( const tr_torrent * tor );
void tr_verifyClose( tr_session * );
#endif