Ignore:
Timestamp:
Feb 2, 2011, 9:17:16 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #2955 "verify pieces only when necessary, or when the user requests it." -- improvements to .resume file

As pointed out by longinus00 and ijuxda, storing per-piece timestamps in the .resume file can involve a lot of overhead. This commit reduces the overhead by adding a couple of optimizations: (1) in cases where *all* or *none* of the files' pieces were checked after the file's mtime, we can safely fold all the pieces' mtimes into a single per-file mtime. (2) since unix time takes up a lot of space when rendered as a benc integer, find a common per-file "baseline" number, then store the pieces' timestamps as offsets from that number. Also add documentation explaining this new format, and also better explaining the pre-2.20 progress format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r11813 r11814  
    23892389}
    23902390
    2391 static time_t
    2392 getFileMTime( const tr_torrent * tor, tr_file_index_t i )
     2391time_t
     2392tr_torrentGetFileMTime( const tr_torrent * tor, tr_file_index_t i )
    23932393{
    23942394    struct stat sb;
     
    24262426    for( ; f < inf->fileCount && pieceHasFile( p, &inf->files[f] ); ++f )
    24272427        if( tr_cpFileIsComplete( &tor->completion, f ) )
    2428             if( getFileMTime( tor, f ) > inf->pieces[p].timeChecked )
     2428            if( tr_torrentGetFileMTime( tor, f ) > inf->pieces[p].timeChecked )
    24292429                return TRUE;
    24302430
Note: See TracChangeset for help on using the changeset viewer.