From 47a60e005e412fa7e0f9f9ad4ac298e4c41698d3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 17 Dec 2010 14:57:19 +0000 Subject: [PATCH] (trunk libT) #2955 "lazy torrent verification" -- speed up setLocalErrorIfFilesDisappeared(). this makes a big difference when loading a lot of torrents on startup. --- libtransmission/torrent.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index d64fa2c8d..57a2ef53d 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -737,10 +737,31 @@ tr_torrentGotNewInfoDict( tr_torrent * tor ) tr_torrentFireMetadataCompleted( tor ); } +static tr_bool +hasAnyLocalData( const tr_torrent * tor ) +{ + tr_file_index_t i; + tr_bool has_local_data = FALSE; + const tr_file_index_t n = tor->info.fileCount; + + for( i=0; icompletion ) > 0 ) && ( tr_torrentGetCurrentSizeOnDisk( tor ) == 0 ); + const tr_bool disappeared = ( tr_cpHaveTotal( &tor->completion ) > 0 ) && !hasAnyLocalData( tor ); if( disappeared ) {