mirror of https://github.com/aria2/aria2
Don't download piece which is filtered out (e.g., --select-file)
This commit fixes the bug that piece which is not requested by --select-file is downloaded in multi-file WebSeeding.pull/765/head
parent
938481bfe9
commit
90452ae11b
|
@ -119,6 +119,9 @@ DefaultPieceStorage::~DefaultPieceStorage() = default;
|
||||||
std::shared_ptr<Piece> DefaultPieceStorage::checkOutPiece(size_t index,
|
std::shared_ptr<Piece> DefaultPieceStorage::checkOutPiece(size_t index,
|
||||||
cuid_t cuid)
|
cuid_t cuid)
|
||||||
{
|
{
|
||||||
|
assert(!bitfieldMan_->isFilterEnabled() ||
|
||||||
|
bitfieldMan_->isFilterBitSet(index));
|
||||||
|
|
||||||
bitfieldMan_->setUseBit(index);
|
bitfieldMan_->setUseBit(index);
|
||||||
|
|
||||||
std::shared_ptr<Piece> piece = findUsedPiece(index);
|
std::shared_ptr<Piece> piece = findUsedPiece(index);
|
||||||
|
@ -398,7 +401,9 @@ DefaultPieceStorage::getMissingPiece(size_t minSplitSize,
|
||||||
std::shared_ptr<Piece> DefaultPieceStorage::getMissingPiece(size_t index,
|
std::shared_ptr<Piece> DefaultPieceStorage::getMissingPiece(size_t index,
|
||||||
cuid_t cuid)
|
cuid_t cuid)
|
||||||
{
|
{
|
||||||
if (hasPiece(index) || isPieceUsed(index)) {
|
if (hasPiece(index) || isPieceUsed(index) ||
|
||||||
|
(bitfieldMan_->isFilterEnabled() &&
|
||||||
|
!bitfieldMan_->isFilterBitSet(index))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue