Changeset 5047


Ignore:
Timestamp:
Feb 16, 2008, 6:12:03 AM (14 years ago)
Author:
charles
Message:

(1.0x) backport the Verify fixes from r5042 (don't lose partial blocks when verifying local data) and r5046 (some torrents were unnecessarily rechecked at the beginning of their second session).

File:
1 edited

Legend:

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

    r4776 r5047  
    276276        else if( !tr_torrentIsPieceChecked( tor, i ) )
    277277        {
    278             const int check = checkPiece( tor, i );
    279             tr_torrentSetHasPiece( tor, i, !check );
    280             tr_torrentSetPieceChecked( tor, i, TRUE );
     278            const int err = checkPiece( tor, i );
     279
     280            if( !err ) /* yay */
     281            {
     282                tr_torrentSetHasPiece( tor, i, TRUE );
     283            }
     284            else
     285            {
     286                /* if we were wrong about it being complete,
     287                * reset and start again.  if we were right about
     288                * it being incomplete, do nothing -- we don't
     289                * want to lose blocks in those incomplete pieces */
     290
     291                if( tr_cpPieceIsComplete( tor->completion, i ) )
     292                    tr_torrentSetHasPiece( tor, i, FALSE );
     293            }
    281294        }
     295
     296        tr_torrentSetPieceChecked( tor, i, TRUE );
    282297    }
    283298}
Note: See TracChangeset for help on using the changeset viewer.