From: Charles Kerr Date: Mon, 14 Apr 2008 20:30:43 +0000 (+0000) Subject: add more debugging messages for loading progress from the bencoded resume file X-Git-Tag: 1.20~168 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35502f05599a42dcffed57da3f6a08c35b23213a;p=transmission add more debugging messages for loading progress from the bencoded resume file --- diff --git a/libtransmission/resume.c b/libtransmission/resume.c index 909405f75..5da71b6d7 100644 --- a/libtransmission/resume.c +++ b/libtransmission/resume.c @@ -242,8 +242,6 @@ loadSpeedLimits( tr_benc * dict, tr_torrent * tor ) **** ***/ -static const time_t verifyNeeded = ~(time_t)0; - static void saveProgress( tr_benc * dict, const tr_torrent * tor ) { @@ -261,9 +259,11 @@ saveProgress( tr_benc * dict, const tr_torrent * tor ) /* add the mtimes */ mtimes = tr_torrentGetMTimes( tor, &n ); m = tr_bencDictAddList( p, KEY_PROGRESS_MTIMES, n ); - for( i=0; icompletion ); @@ -292,16 +292,20 @@ loadProgress( tr_benc * dict, tr_torrent * tor ) && ( m->val.l.count == n ) ) { int i; - for( i=0; ival.l.count; ++i ) + for( i=0; ival.l.vals[i], &x ) - ? x : verifyNeeded; - if( ( t != verifyNeeded ) && ( t == curMTimes[i] ) ) - tr_torrentSetFileChecked( tor, i, TRUE ); - else { + int64_t tmp; + if( !tr_bencGetInt( &m->val.l.vals[i], &tmp ) ) { + tr_tordbg( tor, "File #%d needs to be verified - couldn't find benc entry", i ); tr_torrentSetFileChecked( tor, i, FALSE ); - tr_tordbg( tor, "File #%d needs to be verified", i ); + } else { + const time_t t = (time_t) tmp; + if( t == curMTimes[i] ) + tr_torrentSetFileChecked( tor, i, TRUE ); + else { + tr_tordbg( tor, "File #%d needs to be verified - times %lu and %lu don't match", t, curMTimes[i] ); + tr_torrentSetFileChecked( tor, i, FALSE ); + } } } } diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 55af43848..e086e7868 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1428,14 +1428,14 @@ tr_torrentGetMTimes( const tr_torrent * tor, int * setme_n ) { int i; const int n = tor->info.fileCount; - time_t * m = tr_new( time_t, n ); + time_t * m = tr_new0( time_t, n ); for( i=0; idestination, tor->info.files[i].name, NULL ); - if ( !stat( fname, &sb ) && S_ISREG( sb.st_mode ) ) { + if ( !stat( fname, &sb ) ) { #ifdef SYS_DARWIN m[i] = sb.st_mtimespec.tv_sec; #else