Changeset 5621


Ignore:
Timestamp:
Apr 14, 2008, 8:30:43 PM (14 years ago)
Author:
charles
Message:

add more debugging messages for loading progress from the bencoded resume file

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/resume.c

    r5619 r5621  
    243243***/
    244244
    245 static const time_t verifyNeeded = ~(time_t)0;
    246 
    247245static void
    248246saveProgress( tr_benc * dict, const tr_torrent * tor )
     
    262260    mtimes = tr_torrentGetMTimes( tor, &n );
    263261    m = tr_bencDictAddList( p, KEY_PROGRESS_MTIMES, n );
    264     for( i=0; i<n; ++i )
    265         tr_bencListAddInt( m, tr_torrentIsFileChecked( tor, i )
    266                               ? mtimes[i] : verifyNeeded );
     262    for( i=0; i<n; ++i ) {
     263        if( tr_torrentIsFileChecked( tor, i ) )
     264            mtimes[i] = ~(time_t)0; /* force a recheck */
     265        tr_bencListAddInt( m, mtimes[i] );
     266    }
    267267
    268268    /* add the bitfield */
     
    293293        {
    294294            int i;
    295             for( i=0; i<m->val.l.count; ++i )
     295            for( i=0; i<n; ++i )
    296296            {
    297                 int64_t x;
    298                 const time_t t = tr_bencGetInt( &m->val.l.vals[i], &x )
    299                                  ? x : verifyNeeded;
    300                 if( ( t != verifyNeeded ) && ( t == curMTimes[i] ) )
    301                     tr_torrentSetFileChecked( tor, i, TRUE );
    302                 else {
     297                int64_t tmp;
     298                if( !tr_bencGetInt( &m->val.l.vals[i], &tmp ) ) {
     299                    tr_tordbg( tor, "File #%d needs to be verified - couldn't find benc entry", i );
    303300                    tr_torrentSetFileChecked( tor, i, FALSE );
    304                     tr_tordbg( tor, "File #%d needs to be verified", i );
     301                } else {
     302                    const time_t t = (time_t) tmp;
     303                    if( t == curMTimes[i] )
     304                        tr_torrentSetFileChecked( tor, i, TRUE );
     305                    else {
     306                        tr_tordbg( tor, "File #%d needs to be verified - times %lu and %lu don't match", t, curMTimes[i] );
     307                        tr_torrentSetFileChecked( tor, i, FALSE );
     308                    }
    305309                }
    306310            }
  • trunk/libtransmission/torrent.c

    r5613 r5621  
    14291429    int i;
    14301430    const int n = tor->info.fileCount;
    1431     time_t * m = tr_new( time_t, n );
     1431    time_t * m = tr_new0( time_t, n );
    14321432
    14331433    for( i=0; i<n; ++i ) {
     
    14361436        tr_buildPath( fname, sizeof(fname),
    14371437                      tor->destination, tor->info.files[i].name, NULL );
    1438         if ( !stat( fname, &sb ) && S_ISREG( sb.st_mode ) ) {
     1438        if ( !stat( fname, &sb ) ) {
    14391439#ifdef SYS_DARWIN
    14401440            m[i] = sb.st_mtimespec.tv_sec;
Note: See TracChangeset for help on using the changeset viewer.