Changeset 4885


Ignore:
Timestamp:
Feb 1, 2008, 1:38:57 AM (13 years ago)
Author:
charles
Message:

(1.0x) #666: pausing in the middle of "verify local data" makes T forget about the nonverified portion

Location:
branches/1.0x/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0x/libtransmission/fastresume.c

    r4854 r4885  
    209209    /* Write progress data */
    210210    if (1) {
    211         int n;
     211        int i, n;
    212212        tr_time_t * mtimes;
    213213        uint8_t * buf = malloc( FR_PROGRESS_LEN( tor ) );
     
    217217        /* mtimes */
    218218        mtimes = getMTimes( tor, &n );
     219        for( i=0; i<n; ++i )
     220            if( !tr_torrentIsFileChecked( tor, i ) )
     221                mtimes[i] = ~(tr_time_t)0; /* force a recheck next time */
    219222        memcpy( walk, mtimes, n*sizeof(tr_time_t) );
    220223        walk += n * sizeof(tr_time_t);
     
    419422            if ( curMTimes[i] == mtime )
    420423                tr_torrentSetFileChecked( tor, i, TRUE );
    421             else
     424            else {
     425                tr_torrentSetFileChecked( tor, i, FALSE );
    422426                tr_dbg( "File '%s' recheck needed", tor->info.files[i].name );
     427            }
    423428        }
    424429        free( curMTimes );
  • branches/1.0x/libtransmission/torrent.c

    r4859 r4885  
    12941294}
    12951295
     1296int
     1297tr_torrentIsFileChecked( const tr_torrent * tor, int fileIndex )
     1298{
     1299    const tr_file * file = &tor->info.files[fileIndex];
     1300    const size_t begin = file->firstPiece;
     1301    const size_t end = file->lastPiece + 1;
     1302    size_t i;
     1303    int isChecked = TRUE;
     1304
     1305    for( i=begin; isChecked && i<end; ++i )
     1306        if( !tr_torrentIsPieceChecked( tor, i ) )
     1307            isChecked = FALSE;
     1308
     1309    return isChecked;
     1310}
     1311
    12961312void
    12971313tr_torrentUncheck( tr_torrent * tor )
  • branches/1.0x/libtransmission/torrent.h

    r4854 r4885  
    8585int  tr_torrentCountUncheckedPieces( const tr_torrent * );
    8686int  tr_torrentIsPieceChecked      ( const tr_torrent *, int piece );
     87int  tr_torrentIsFileChecked       ( const tr_torrent *, int file );
    8788void tr_torrentSetPieceChecked     ( tr_torrent *, int piece, int isChecked );
    8889void tr_torrentSetFileChecked      ( tr_torrent *, int file, int isChecked );
Note: See TracChangeset for help on using the changeset viewer.