Skip to content

Commit

Permalink
Don't set piece checked stamp for non existent files or hash fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfpp2p committed May 27, 2017
1 parent 0ea3065 commit fd4c044
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libtransmission/torrent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,8 @@ setExistingFilesVerified( tr_torrent * tor )
for( pi = 0; pi < info->pieceCount; ++pi )
{
tr_torrentSetHasPiece( tor, pi, !missing[pi] );
tr_torrentSetPieceChecked( tor, pi );
if( !missing[pi] )
tr_torrentSetPieceChecked( tor, pi );
}
}

Expand Down Expand Up @@ -3197,7 +3198,8 @@ tr_torrentCheckPiece( tr_torrent * tor, tr_piece_index_t pieceIndex )

tr_deeplog_tor( tor, "[LAZY] tr_torrentCheckPiece tested piece %zu, pass==%d", (size_t)pieceIndex, (int)pass );
tr_torrentSetHasPiece( tor, pieceIndex, pass );
tr_torrentSetPieceChecked( tor, pieceIndex );
if( pass )
tr_torrentSetPieceChecked( tor, pieceIndex );
tor->anyDate = tr_time( );
tr_torrentSetDirty( tor );

Expand Down
3 changes: 2 additions & 1 deletion libtransmission/verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ verifyTorrent( tr_torrent * tor, bool * stopFlag )
tr_torrentSetHasPiece( tor, pieceIndex, hasPiece );
changed |= hasPiece != hadPiece;
}
tr_torrentSetPieceChecked( tor, pieceIndex );
if( hasPiece )
tr_torrentSetPieceChecked( tor, pieceIndex );
now = tr_time( );
tor->anyDate = now;

Expand Down

0 comments on commit fd4c044

Please sign in to comment.