when a peer sends us a block and we count it in tr_cpBlockAdd(), don't invalidate cp.sizeWhenDone unless sizeWhenDone wasn't already including that new block.

This commit is contained in:
Jordan Lee 2012-12-15 03:47:11 +00:00
parent df5b6365bd
commit 89b3c5fc0a
1 changed files with 3 additions and 1 deletions

View File

@ -102,11 +102,13 @@ tr_cpBlockAdd (tr_completion * cp, tr_block_index_t block)
if (!tr_cpBlockIsComplete (cp, block))
{
const tr_piece_index_t piece = tr_torBlockPiece (cp->tor, block);
tr_bitfieldAdd (&cp->blockBitfield, block);
cp->sizeNow += tr_torBlockCountBytes (tor, block);
cp->haveValidIsDirty = true;
cp->sizeWhenDoneIsDirty = true;
cp->sizeWhenDoneIsDirty |= tor->info.pieces[piece].dnd;
}
}