mirror of https://github.com/aria2/aria2
2010-04-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Hold reference to PieceStorage when paused in order to provide progress information via XML-RPC. * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupMan.ccpull/1/head
parent
a605048900
commit
1f02b65460
|
@ -1,3 +1,11 @@
|
|||
2010-04-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Hold reference to PieceStorage when paused in order to provide
|
||||
progress information via XML-RPC.
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroup.h
|
||||
* src/RequestGroupMan.cc
|
||||
|
||||
2010-04-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Defined struct timespec if it is not available.
|
||||
|
|
|
@ -533,6 +533,12 @@ void RequestGroup::initPieceStorage()
|
|||
_segmentMan = tempSegmentMan;
|
||||
}
|
||||
|
||||
void RequestGroup::dropPieceStorage()
|
||||
{
|
||||
_segmentMan.reset();
|
||||
_pieceStorage.reset();
|
||||
}
|
||||
|
||||
bool RequestGroup::downloadFinishedByFileLength()
|
||||
{
|
||||
// assuming that a control file doesn't exist.
|
||||
|
@ -891,8 +897,8 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
|
|||
if(!_pieceStorage.isNull()) {
|
||||
_pieceStorage->removeAdvertisedPiece(0);
|
||||
}
|
||||
_segmentMan.reset();
|
||||
_pieceStorage.reset();
|
||||
// Don't reset _segmentMan and _pieceStorage here to provide
|
||||
// progress information via XML-RPC
|
||||
_progressInfoFile.reset();
|
||||
_downloadContext->releaseRuntimeResource();
|
||||
}
|
||||
|
|
|
@ -379,6 +379,8 @@ public:
|
|||
// they are not.
|
||||
void initPieceStorage();
|
||||
|
||||
void dropPieceStorage();
|
||||
|
||||
bool downloadFinishedByFileLength();
|
||||
|
||||
void loadAndOpenFile(const SharedHandle<BtProgressInfoFile>& progressInfoFile);
|
||||
|
|
|
@ -528,6 +528,9 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
|
|||
temp.push_back(groupToAdd);
|
||||
continue;
|
||||
}
|
||||
// Drop pieceStorage here because paused download holds its
|
||||
// reference.
|
||||
groupToAdd->dropPieceStorage();
|
||||
configureRequestGroup(groupToAdd);
|
||||
createInitialCommand(groupToAdd, commands, e);
|
||||
groupToAdd->setRequestGroupMan(this);
|
||||
|
|
Loading…
Reference in New Issue