mirror of https://github.com/aria2/aria2
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Release pooled and in-flight Request objectsand URIResult objects in FileEntry after download completed. * src/DownloadContext.cc * src/DownloadContext.h * src/FileEntry.cc * src/FileEntry.h * src/RequestGroup.ccpull/1/head
parent
f0edf98651
commit
e40d6b7c0f
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Release pooled and in-flight Request objectsand URIResult objects
|
||||
in FileEntry after download completed.
|
||||
* src/DownloadContext.cc
|
||||
* src/DownloadContext.h
|
||||
* src/FileEntry.cc
|
||||
* src/FileEntry.h
|
||||
* src/RequestGroup.cc
|
||||
|
||||
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Set manual and source attribute in aria2c.1.txt
|
||||
|
|
|
@ -165,4 +165,12 @@ bool DownloadContext::hasAttribute(const std::string& key) const
|
|||
}
|
||||
}
|
||||
|
||||
void DownloadContext::releaseRuntimeResource()
|
||||
{
|
||||
for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
|
||||
_fileEntries.begin(); i != _fileEntries.end(); ++i) {
|
||||
(*i)->releaseRuntimeResource();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -235,6 +235,8 @@ public:
|
|||
// Returns FileEntry at given offset. SharedHandle<FileEntry>() is
|
||||
// returned if no such FileEntry is found.
|
||||
SharedHandle<FileEntry> findFileEntryByOffset(off_t offset) const;
|
||||
|
||||
void releaseRuntimeResource();
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -313,4 +313,11 @@ void FileEntry::reuseUri(size_t num)
|
|||
}
|
||||
}
|
||||
|
||||
void FileEntry::releaseRuntimeResource()
|
||||
{
|
||||
_requestPool.clear();
|
||||
_inFlightRequests.clear();
|
||||
_uriResults.clear();
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -231,6 +231,8 @@ public:
|
|||
// reuse, those URIs are used more than once so that num URIs total
|
||||
// are available to reuse.
|
||||
void reuseUri(size_t num);
|
||||
|
||||
void releaseRuntimeResource();
|
||||
};
|
||||
|
||||
typedef SharedHandle<FileEntry> FileEntryHandle;
|
||||
|
|
|
@ -800,6 +800,7 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
|
|||
if(!_pieceStorage.isNull()) {
|
||||
_pieceStorage->removeAdvertisedPiece(0);
|
||||
}
|
||||
_downloadContext->releaseRuntimeResource();
|
||||
}
|
||||
|
||||
void RequestGroup::preDownloadProcessing()
|
||||
|
@ -945,8 +946,6 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
|
|||
sessionDownloadLength +=
|
||||
_segmentMan->calculateSessionDownloadLength();
|
||||
}
|
||||
|
||||
// TODO1.5 Purge unnecessary data in FileEntry here.
|
||||
return
|
||||
SharedHandle<DownloadResult>
|
||||
(new DownloadResult(_gid,
|
||||
|
|
Loading…
Reference in New Issue