2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Call DownloadContext::setOwnerRequestGroup() in
	RequestGroup::setDownloadContext().
	* src/BtDependency.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/download_helper.cc
	* test/DefaultBtMessageDispatcherTest.cc
	* test/DefaultExtensionMessageFactoryTest.cc
	* test/HandshakeExtensionMessageTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-11-28 10:12:04 +00:00
parent 339795311b
commit 88bfe8b084
8 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,15 @@
2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Call DownloadContext::setOwnerRequestGroup() in
RequestGroup::setDownloadContext().
* src/BtDependency.cc
* src/RequestGroup.cc
* src/RequestGroup.h
* src/download_helper.cc
* test/DefaultBtMessageDispatcherTest.cc
* test/DefaultExtensionMessageFactoryTest.cc
* test/HandshakeExtensionMessageTest.cc
2009-11-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Accept BitTorrent Magnet URI in Metalink resource type bittorrent.

View File

@ -107,7 +107,6 @@ bool BtDependency::resolve()
}
_logger->debug("Dependency resolved for GID#%d", _dependant->getGID());
_dependant->setDownloadContext(context);
context->setOwnerRequestGroup(_dependant.get());
return true;
} else if(_dependee->getNumCommand() == 0) {
// _dependee's download failed.

View File

@ -1045,4 +1045,13 @@ void RequestGroup::removeControlFile() const
_progressInfoFile->removeFile();
}
void RequestGroup::setDownloadContext
(const SharedHandle<DownloadContext>& downloadContext)
{
_downloadContext = downloadContext;
if(!_downloadContext.isNull()) {
_downloadContext->setOwnerRequestGroup(this);
}
}
} // namespace aria2

View File

@ -244,10 +244,9 @@ public:
return _downloadContext;
}
void setDownloadContext(const SharedHandle<DownloadContext>& downloadContext)
{
_downloadContext = downloadContext;
}
// This function also calls
// downloadContext->setOwnerRequestGroup(this).
void setDownloadContext(const SharedHandle<DownloadContext>& downloadContext);
const SharedHandle<PieceStorage>& getPieceStorage() const
{

View File

@ -223,7 +223,6 @@ createBtRequestGroup(const std::string& torrentFilePath,
((*i).first, strconcat(dctx->getDir(), "/", (*i).second));
}
rg->setDownloadContext(dctx);
dctx->setOwnerRequestGroup(rg.get());
return rg;
}
@ -246,7 +245,6 @@ createBtMagnetRequestGroup(const std::string& magnetLink,
dctx->getFirstFileEntry()->setPath
(dctx->getAttribute(bittorrent::BITTORRENT)[bittorrent::NAME].s());
rg->setDownloadContext(dctx);
dctx->setOwnerRequestGroup(rg.get());
rg->clearPostDownloadHandler();
rg->addPostDownloadHandler
(SharedHandle<UTMetadataPostDownloadHandler>

View File

@ -141,7 +141,8 @@ public:
_dctx.reset(new DownloadContext());
bittorrent::load("test.torrent", _dctx);
_dctx->setOwnerRequestGroup(_rg.get());
_rg->setDownloadContext(_dctx);
peer.reset(new Peer("192.168.0.1", 6969));
peer->allocateSessionResource

View File

@ -67,7 +67,6 @@ public:
SharedHandle<Option> option(new Option());
_requestGroup.reset(new RequestGroup(option));
_requestGroup->setDownloadContext(_dctx);
_dctx->setOwnerRequestGroup(_requestGroup.get());
_factory.reset(new DefaultExtensionMessageFactory());
_factory->setPeerStorage(_peerStorage);

View File

@ -95,7 +95,6 @@ void HandshakeExtensionMessageTest::testDoReceivedAction()
SharedHandle<Option> op(new Option());
RequestGroup rg(op);
rg.setDownloadContext(dctx);
dctx->setOwnerRequestGroup(&rg);
BDE attrs = BDE::dict();
dctx->setAttribute(bittorrent::BITTORRENT, attrs);