Ignore:
Timestamp:
Feb 2, 2011, 8:30:04 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3973 "JIT verification verifies freshly-downloaded torrents" -- test fix.

Files downloaded in Transmission 2.20 betas [1..3] forced each piece to be checked twice -- once on download, and once when uploading the piece for the first time. Older versions of Transmission didn't perform the latter check unless the file had changed after it was downloaded. This commit restores that behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r11786 r11813  
    29522952    char * sub;
    29532953    const char * base;
     2954    const tr_info * inf = &tor->info;
     2955    const tr_file * f = &inf->files[fileNum];
     2956    tr_piece * p;
     2957    const tr_piece * pend;
     2958    const time_t now = tr_time( );
    29542959
    29552960    /* close the file so that we can reopen in read-only mode as needed */
    29562961    tr_fdFileClose( tor->session, tor, fileNum );
     2962
     2963    /* now that the file is complete and closed, we can start watching its
     2964     * mtime timestamp for changes to know if we need to reverify pieces */
     2965    fprintf( stderr, "file %d completed.. setting all files' timestamps to %zu (%s)\n", (int)fileNum, (size_t)now, f->name );
     2966    for( p=&inf->pieces[f->firstPiece], pend=&inf->pieces[f->lastPiece]; p!=pend; ++p )
     2967        p->timeChecked = now;
    29572968
    29582969    /* if the torrent's current filename isn't the same as the one in the
     
    29612972    if( tr_torrentFindFile2( tor, fileNum, &base, &sub ) )
    29622973    {
    2963         const tr_file * file = &tor->info.files[fileNum];
    2964 
    2965         if( strcmp( sub, file->name ) )
     2974        if( strcmp( sub, f->name ) )
    29662975        {
    29672976            char * oldpath = tr_buildPath( base, sub, NULL );
    2968             char * newpath = tr_buildPath( base, file->name, NULL );
     2977            char * newpath = tr_buildPath( base, f->name, NULL );
    29692978
    29702979            if( rename( oldpath, newpath ) )
Note: See TracChangeset for help on using the changeset viewer.