diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 541019dcd..341c1d583 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1124,10 +1124,15 @@ torrentStart( tr_torrent * tor, if( !tor->isRunning ) { - if( reloadProgress ) + const int isVerifying = tr_verifyInProgress( tor ); + + if( !isVerifying && reloadProgress ) tr_torrentLoadResume( tor, TR_FR_PROGRESS, NULL ); + tor->isRunning = 1; - tr_verifyAdd( tor, checkAndStartCB ); + + if( !isVerifying ) + tr_verifyAdd( tor, checkAndStartCB ); } tr_globalUnlock( tor->session ); diff --git a/libtransmission/verify.c b/libtransmission/verify.c index 6fa3637e1..ad6262aa2 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.c @@ -201,6 +201,20 @@ compareVerifyByTorrent( const void * va, return a->torrent - b; } +int +tr_verifyInProgress( const tr_torrent * tor ) +{ + int found = FALSE; + tr_lock * lock = getVerifyLock( ); + tr_lockLock( lock ); + + found = ( tor == currentNode.torrent ) + || ( tr_list_find( verifyList, tor, compareVerifyByTorrent ) != NULL ); + + tr_lockUnlock( lock ); + return found; +} + void tr_verifyRemove( tr_torrent * tor ) { diff --git a/libtransmission/verify.h b/libtransmission/verify.h index 2f05e1775..d634cb7be 100644 --- a/libtransmission/verify.h +++ b/libtransmission/verify.h @@ -20,4 +20,6 @@ void tr_verifyAdd( tr_torrent * tor, void tr_verifyRemove( tr_torrent * tor ); +int tr_verifyInProgress( const tr_torrent * tor ); + #endif