mirror of
https://github.com/transmission/transmission
synced 2025-03-09 13:50:00 +00:00
#666: pausing in the middle of "verify local data" makes T forget about the nonverified portion
This commit is contained in:
parent
375949551b
commit
88cfec047f
3 changed files with 24 additions and 2 deletions
|
@ -208,7 +208,7 @@ tr_fastResumeSave( const tr_torrent * tor )
|
|||
|
||||
/* Write progress data */
|
||||
if (1) {
|
||||
int n;
|
||||
int i, n;
|
||||
tr_time_t * mtimes;
|
||||
uint8_t * buf = malloc( FR_PROGRESS_LEN( tor ) );
|
||||
uint8_t * walk = buf;
|
||||
|
@ -216,6 +216,9 @@ tr_fastResumeSave( const tr_torrent * tor )
|
|||
|
||||
/* mtimes */
|
||||
mtimes = getMTimes( tor, &n );
|
||||
for( i=0; i<n; ++i )
|
||||
if( !tr_torrentIsFileChecked( tor, i ) )
|
||||
mtimes[i] = ~(tr_time_t)0; /* force a recheck next time */
|
||||
memcpy( walk, mtimes, n*sizeof(tr_time_t) );
|
||||
walk += n * sizeof(tr_time_t);
|
||||
|
||||
|
@ -418,8 +421,10 @@ parseProgress( tr_torrent * tor,
|
|||
readBytes( &mtime, &walk, sizeof(tr_time_t) );
|
||||
if ( curMTimes[i] == mtime )
|
||||
tr_torrentSetFileChecked( tor, i, TRUE );
|
||||
else
|
||||
else {
|
||||
tr_torrentSetFileChecked( tor, i, FALSE );
|
||||
tr_dbg( "File '%s' recheck needed", tor->info.files[i].name );
|
||||
}
|
||||
}
|
||||
free( curMTimes );
|
||||
|
||||
|
|
|
@ -1317,6 +1317,22 @@ tr_torrentSetFileChecked( tr_torrent * tor, int fileIndex, int isChecked )
|
|||
tr_bitfieldRemRange ( tor->checkedPieces, begin, end );
|
||||
}
|
||||
|
||||
int
|
||||
tr_torrentIsFileChecked( const tr_torrent * tor, int fileIndex )
|
||||
{
|
||||
const tr_file * file = &tor->info.files[fileIndex];
|
||||
const size_t begin = file->firstPiece;
|
||||
const size_t end = file->lastPiece + 1;
|
||||
size_t i;
|
||||
int isChecked = TRUE;
|
||||
|
||||
for( i=begin; isChecked && i<end; ++i )
|
||||
if( !tr_torrentIsPieceChecked( tor, i ) )
|
||||
isChecked = FALSE;
|
||||
|
||||
return isChecked;
|
||||
}
|
||||
|
||||
void
|
||||
tr_torrentUncheck( tr_torrent * tor )
|
||||
{
|
||||
|
|
|
@ -84,6 +84,7 @@ void tr_torrentInitFilePriority( tr_torrent * tor,
|
|||
|
||||
int tr_torrentCountUncheckedPieces( const tr_torrent * );
|
||||
int tr_torrentIsPieceChecked ( const tr_torrent *, int piece );
|
||||
int tr_torrentIsFileChecked ( const tr_torrent *, int file );
|
||||
void tr_torrentSetPieceChecked ( tr_torrent *, int piece, int isChecked );
|
||||
void tr_torrentSetFileChecked ( tr_torrent *, int file, int isChecked );
|
||||
void tr_torrentUncheck ( tr_torrent * );
|
||||
|
|
Loading…
Add table
Reference in a new issue