diff --git a/ChangeLog b/ChangeLog index 4a4ed6af..a3f5d10c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-11-28 Tatsuhiro Tsujikawa + + 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 Accept BitTorrent Magnet URI in Metalink resource type bittorrent. diff --git a/src/BtDependency.cc b/src/BtDependency.cc index 270e27ca..a7a11640 100644 --- a/src/BtDependency.cc +++ b/src/BtDependency.cc @@ -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. diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 67e540e3..f66da9f7 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -1045,4 +1045,13 @@ void RequestGroup::removeControlFile() const _progressInfoFile->removeFile(); } +void RequestGroup::setDownloadContext +(const SharedHandle& downloadContext) +{ + _downloadContext = downloadContext; + if(!_downloadContext.isNull()) { + _downloadContext->setOwnerRequestGroup(this); + } +} + } // namespace aria2 diff --git a/src/RequestGroup.h b/src/RequestGroup.h index f390d1ae..5f7f93b0 100644 --- a/src/RequestGroup.h +++ b/src/RequestGroup.h @@ -244,10 +244,9 @@ public: return _downloadContext; } - void setDownloadContext(const SharedHandle& downloadContext) - { - _downloadContext = downloadContext; - } + // This function also calls + // downloadContext->setOwnerRequestGroup(this). + void setDownloadContext(const SharedHandle& downloadContext); const SharedHandle& getPieceStorage() const { diff --git a/src/download_helper.cc b/src/download_helper.cc index 12e9aed8..c33b9ce4 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -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 diff --git a/test/DefaultBtMessageDispatcherTest.cc b/test/DefaultBtMessageDispatcherTest.cc index 6e37e531..c3f664b2 100644 --- a/test/DefaultBtMessageDispatcherTest.cc +++ b/test/DefaultBtMessageDispatcherTest.cc @@ -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 diff --git a/test/DefaultExtensionMessageFactoryTest.cc b/test/DefaultExtensionMessageFactoryTest.cc index 9ace3e29..921da4f3 100644 --- a/test/DefaultExtensionMessageFactoryTest.cc +++ b/test/DefaultExtensionMessageFactoryTest.cc @@ -67,7 +67,6 @@ public: SharedHandle