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