mirror of https://github.com/aria2/aria2
2010-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Create SharedHandle outside of function call to avoid unexpected memory leak. * src/AnnounceList.cc * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/RequestGroup.cc * src/RequestGroupMan.cc * src/UTMetadataPostDownloadHandler.cc * src/download_helper.ccpull/1/head
parent
e728385bc9
commit
bcf4593bda
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Create SharedHandle outside of function call to avoid unexpected
|
||||
memory leak.
|
||||
* src/AnnounceList.cc
|
||||
* src/FtpNegotiationCommand.cc
|
||||
* src/HttpResponseCommand.cc
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroupMan.cc
|
||||
* src/UTMetadataPostDownloadHandler.cc
|
||||
* src/download_helper.cc
|
||||
|
||||
2010-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Updated supported hash functions.
|
||||
|
|
|
@ -79,7 +79,8 @@ void AnnounceList::reconfigure
|
|||
void AnnounceList::reconfigure(const std::string& url) {
|
||||
std::deque<std::string> urls;
|
||||
urls.push_back(url);
|
||||
tiers_.push_back(SharedHandle<AnnounceTier>(new AnnounceTier(urls)));
|
||||
SharedHandle<AnnounceTier> tier(new AnnounceTier(urls));
|
||||
tiers_.push_back(tier);
|
||||
resetIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -431,12 +431,10 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
|||
getSegmentMan()->getSegmentWithIndex(getCuid(), 0);
|
||||
return true;
|
||||
} else {
|
||||
getRequestGroup()->adjustFilename
|
||||
(SharedHandle<BtProgressInfoFile>
|
||||
(new DefaultBtProgressInfoFile
|
||||
(getDownloadContext(),
|
||||
SharedHandle<PieceStorage>(),
|
||||
getOption().get())));
|
||||
SharedHandle<BtProgressInfoFile> progressInfoFile
|
||||
(new DefaultBtProgressInfoFile
|
||||
(getDownloadContext(), SharedHandle<PieceStorage>(), getOption().get()));
|
||||
getRequestGroup()->adjustFilename(progressInfoFile);
|
||||
getRequestGroup()->initPieceStorage();
|
||||
|
||||
if(getOption()->getAsBool(PREF_DRY_RUN)) {
|
||||
|
|
|
@ -293,11 +293,10 @@ bool HttpResponseCommand::handleDefaultEncoding
|
|||
(const SharedHandle<HttpResponse>& httpResponse)
|
||||
{
|
||||
SharedHandle<HttpRequest> httpRequest = httpResponse->getHttpRequest();
|
||||
getRequestGroup()->adjustFilename
|
||||
(SharedHandle<BtProgressInfoFile>(new DefaultBtProgressInfoFile
|
||||
(getDownloadContext(),
|
||||
SharedHandle<PieceStorage>(),
|
||||
getOption().get())));
|
||||
SharedHandle<BtProgressInfoFile> progressInfoFile
|
||||
(new DefaultBtProgressInfoFile
|
||||
(getDownloadContext(), SharedHandle<PieceStorage>(), getOption().get()));
|
||||
getRequestGroup()->adjustFilename(progressInfoFile);
|
||||
getRequestGroup()->initPieceStorage();
|
||||
|
||||
if(getOption()->getAsBool(PREF_DRY_RUN)) {
|
||||
|
|
|
@ -484,11 +484,10 @@ void RequestGroup::createInitialCommand
|
|||
(StringFormat(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||
downloadContext_->getBasePath().c_str()).str());
|
||||
}
|
||||
adjustFilename
|
||||
(SharedHandle<BtProgressInfoFile>(new DefaultBtProgressInfoFile
|
||||
(downloadContext_,
|
||||
SharedHandle<PieceStorage>(),
|
||||
option_.get())));
|
||||
SharedHandle<BtProgressInfoFile> progressInfoFile
|
||||
(new DefaultBtProgressInfoFile
|
||||
(downloadContext_, SharedHandle<PieceStorage>(), option_.get()));
|
||||
adjustFilename(progressInfoFile);
|
||||
initPieceStorage();
|
||||
SharedHandle<CheckIntegrityEntry> checkEntry =
|
||||
createCheckIntegrityEntry();
|
||||
|
@ -601,8 +600,9 @@ void RequestGroup::initPieceStorage()
|
|||
if(logger_->debug()) {
|
||||
logger_->debug("Using LongestSequencePieceSelector");
|
||||
}
|
||||
ps->setPieceSelector
|
||||
(SharedHandle<PieceSelector>(new LongestSequencePieceSelector()));
|
||||
SharedHandle<PieceSelector> longestPieceSelector
|
||||
(new LongestSequencePieceSelector());
|
||||
ps->setPieceSelector(longestPieceSelector);
|
||||
}
|
||||
if(option_->defined(PREF_BT_PRIORITIZE_PIECE)) {
|
||||
std::vector<size_t> result;
|
||||
|
|
|
@ -463,22 +463,22 @@ void RequestGroupMan::configureRequestGroup
|
|||
{
|
||||
const std::string& uriSelectorValue = option_->get(PREF_URI_SELECTOR);
|
||||
if(uriSelectorValue == V_FEEDBACK) {
|
||||
requestGroup->setURISelector
|
||||
(SharedHandle<URISelector>(new FeedbackURISelector(serverStatMan_)));
|
||||
SharedHandle<URISelector> sel(new FeedbackURISelector(serverStatMan_));
|
||||
requestGroup->setURISelector(sel);
|
||||
} else if(uriSelectorValue == V_INORDER) {
|
||||
requestGroup->setURISelector
|
||||
(SharedHandle<URISelector>(new InOrderURISelector()));
|
||||
SharedHandle<URISelector> sel(new InOrderURISelector());
|
||||
requestGroup->setURISelector(sel);
|
||||
} else if(uriSelectorValue == V_ADAPTIVE) {
|
||||
requestGroup->setURISelector
|
||||
(SharedHandle<URISelector>(new AdaptiveURISelector(serverStatMan_,
|
||||
requestGroup.get())));
|
||||
SharedHandle<URISelector> sel(new AdaptiveURISelector(serverStatMan_,
|
||||
requestGroup.get()));
|
||||
requestGroup->setURISelector(sel);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
void createInitialCommand(const SharedHandle<RequestGroup>& requestGroup,
|
||||
std::vector<Command*>& commands,
|
||||
DownloadEngine* e)
|
||||
DownloadEngine* e)
|
||||
{
|
||||
requestGroup->createInitialCommand(commands, e);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ bool UTMetadataPostDownloadHandler::Criteria::match
|
|||
UTMetadataPostDownloadHandler::UTMetadataPostDownloadHandler():
|
||||
logger_(LogFactory::getInstance())
|
||||
{
|
||||
setCriteria(SharedHandle<Criteria>(new Criteria()));
|
||||
SharedHandle<Criteria> cri(new Criteria());
|
||||
setCriteria(cri);
|
||||
}
|
||||
|
||||
void UTMetadataPostDownloadHandler::getNextRequestGroups
|
||||
|
|
|
@ -311,9 +311,9 @@ createBtMagnetRequestGroup(const std::string& magnetLink,
|
|||
dctx->getFirstFileEntry()->setPath(torrentAttrs->name);
|
||||
rg->setDownloadContext(dctx);
|
||||
rg->clearPostDownloadHandler();
|
||||
rg->addPostDownloadHandler
|
||||
(SharedHandle<UTMetadataPostDownloadHandler>
|
||||
(new UTMetadataPostDownloadHandler()));
|
||||
SharedHandle<UTMetadataPostDownloadHandler> utMetadataPostHandler
|
||||
(new UTMetadataPostDownloadHandler());
|
||||
rg->addPostDownloadHandler(utMetadataPostHandler);
|
||||
rg->setDiskWriterFactory
|
||||
(SharedHandle<DiskWriterFactory>(new ByteArrayDiskWriterFactory()));
|
||||
rg->setMetadataInfo(createMetadataInfo(magnetLink));
|
||||
|
|
Loading…
Reference in New Issue