mirror of https://github.com/aria2/aria2
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added Piece::getFirstMissingBlockIndexWithoutLock() and it is called from PiecedSegment's ctor. Previously Piece::getAllMissingBlockIndexes() is called from PiecedSegment() but it is rather expensive since only first element is used. * src/PiecedSegment.cc * src/Piece.{h, cc}pull/1/head
parent
5516bc02cb
commit
1a4100cbc9
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Added Piece::getFirstMissingBlockIndexWithoutLock() and it is called
|
||||||
|
from PiecedSegment's ctor.
|
||||||
|
Previously Piece::getAllMissingBlockIndexes() is called from
|
||||||
|
PiecedSegment() but it is rather expensive since only first element is
|
||||||
|
used.
|
||||||
|
* src/PiecedSegment.cc
|
||||||
|
* src/Piece.{h, cc}
|
||||||
|
|
||||||
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Rewritten get*Missing*Index functions. Now no need to allocate memory
|
Rewritten get*Missing*Index functions. Now no need to allocate memory
|
||||||
|
|
|
@ -95,6 +95,11 @@ int32_t Piece::getMissingBlockIndex() const {
|
||||||
return blockIndex;
|
return blockIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t Piece::getFirstMissingBlockIndexWithoutLock() const
|
||||||
|
{
|
||||||
|
return bitfield->getFirstMissingIndex();
|
||||||
|
}
|
||||||
|
|
||||||
BlockIndexes Piece::getAllMissingBlockIndexes() const {
|
BlockIndexes Piece::getAllMissingBlockIndexes() const {
|
||||||
return bitfield->getAllMissingIndexes();
|
return bitfield->getAllMissingIndexes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
|
|
||||||
int32_t getMissingUnusedBlockIndex() const;
|
int32_t getMissingUnusedBlockIndex() const;
|
||||||
int32_t getMissingBlockIndex() const;
|
int32_t getMissingBlockIndex() const;
|
||||||
|
int32_t getFirstMissingBlockIndexWithoutLock() const;
|
||||||
BlockIndexes getAllMissingBlockIndexes() const;
|
BlockIndexes getAllMissingBlockIndexes() const;
|
||||||
void completeBlock(int32_t blockIndex);
|
void completeBlock(int32_t blockIndex);
|
||||||
void cancelBlock(int32_t blockIndex);
|
void cancelBlock(int32_t blockIndex);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
PiecedSegment::PiecedSegment(int32_t pieceLength, const PieceHandle& piece):
|
PiecedSegment::PiecedSegment(int32_t pieceLength, const PieceHandle& piece):
|
||||||
_pieceLength(pieceLength), _overflowLength(0), _piece(piece)
|
_pieceLength(pieceLength), _overflowLength(0), _piece(piece)
|
||||||
{
|
{
|
||||||
_writtenLength = _piece->getAllMissingBlockIndexes().front()*_piece->getBlockLength();
|
_writtenLength = _piece->getFirstMissingBlockIndexWithoutLock()*_piece->getBlockLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
PiecedSegment::~PiecedSegment() {}
|
PiecedSegment::~PiecedSegment() {}
|
||||||
|
|
Loading…
Reference in New Issue