mirror of https://github.com/aria2/aria2
2010-01-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed RequestGroup::initSegmentMan(). Guaranteed that either both _pieceStorage and _segmentMan are initialized or they are not. * src/RequestGroup.cc * src/RequestGroup.h * test/BtDependencyTest.ccpull/1/head
parent
403e8c5754
commit
6645df820e
|
@ -1,3 +1,12 @@
|
|||
2010-01-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed RequestGroup::initSegmentMan(). Guaranteed that either
|
||||
both _pieceStorage and _segmentMan are initialized or they are
|
||||
not.
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroup.h
|
||||
* test/BtDependencyTest.cc
|
||||
|
||||
2010-01-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Bump up version number to 1.8.2
|
||||
|
|
|
@ -150,13 +150,6 @@ RequestGroup::RequestGroup(const SharedHandle<Option>& option):
|
|||
|
||||
RequestGroup::~RequestGroup() {}
|
||||
|
||||
const SegmentManHandle& RequestGroup::initSegmentMan()
|
||||
{
|
||||
_segmentMan = _segmentManFactory->createNewInstance(_downloadContext,
|
||||
_pieceStorage);
|
||||
return _segmentMan;
|
||||
}
|
||||
|
||||
bool RequestGroup::downloadFinished() const
|
||||
{
|
||||
if(_pieceStorage.isNull()) {
|
||||
|
@ -445,6 +438,7 @@ void RequestGroup::processCheckIntegrityEntry(std::deque<Command*>& commands,
|
|||
|
||||
void RequestGroup::initPieceStorage()
|
||||
{
|
||||
SharedHandle<PieceStorage> tempPieceStorage;
|
||||
if(_downloadContext->knowsTotalLength()) {
|
||||
#ifdef ENABLE_BITTORRENT
|
||||
SharedHandle<DefaultPieceStorage> ps
|
||||
|
@ -483,17 +477,21 @@ void RequestGroup::initPieceStorage()
|
|||
if(!_diskWriterFactory.isNull()) {
|
||||
ps->setDiskWriterFactory(_diskWriterFactory);
|
||||
}
|
||||
_pieceStorage = ps;
|
||||
tempPieceStorage = ps;
|
||||
} else {
|
||||
UnknownLengthPieceStorageHandle ps
|
||||
(new UnknownLengthPieceStorage(_downloadContext, _option.get()));
|
||||
if(!_diskWriterFactory.isNull()) {
|
||||
ps->setDiskWriterFactory(_diskWriterFactory);
|
||||
}
|
||||
_pieceStorage = ps;
|
||||
tempPieceStorage = ps;
|
||||
}
|
||||
_pieceStorage->initStorage();
|
||||
initSegmentMan();
|
||||
tempPieceStorage->initStorage();
|
||||
SharedHandle<SegmentMan> tempSegmentMan =
|
||||
_segmentManFactory->createNewInstance(_downloadContext, tempPieceStorage);
|
||||
|
||||
_pieceStorage = tempPieceStorage;
|
||||
_segmentMan = tempSegmentMan;
|
||||
}
|
||||
|
||||
bool RequestGroup::downloadFinishedByFileLength()
|
||||
|
|
|
@ -186,11 +186,6 @@ public:
|
|||
RequestGroup(const SharedHandle<Option>& option);
|
||||
|
||||
~RequestGroup();
|
||||
/**
|
||||
* Reinitializes SegmentMan based on current property values and
|
||||
* returns new one.
|
||||
*/
|
||||
const SharedHandle<SegmentMan>& initSegmentMan();
|
||||
|
||||
const SharedHandle<SegmentMan>& getSegmentMan() const
|
||||
{
|
||||
|
@ -359,6 +354,9 @@ public:
|
|||
const SharedHandle<CheckIntegrityEntry>& entry,
|
||||
DownloadEngine* e);
|
||||
|
||||
// Initializes _pieceStorage and _segmentMan. We guarantee that
|
||||
// either both of _pieceStorage and _segmentMan are initialized or
|
||||
// they are not.
|
||||
void initPieceStorage();
|
||||
|
||||
bool downloadFinishedByFileLength();
|
||||
|
|
|
@ -53,10 +53,7 @@ class BtDependencyTest:public CppUnit::TestFixture {
|
|||
(new DownloadContext(1024*1024, length, torrentFile));
|
||||
dctx->setDir(".");
|
||||
dependee->setDownloadContext(dctx);
|
||||
DefaultPieceStorageHandle ps(new DefaultPieceStorage(dctx, option.get()));
|
||||
dependee->setPieceStorage(ps);
|
||||
ps->initStorage();
|
||||
dependee->initSegmentMan();
|
||||
dependee->initPieceStorage();
|
||||
return dependee;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue