summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BtSetup.cc12
-rw-r--r--src/DownloadEngine.cc2
-rw-r--r--src/DownloadEngine.h4
-rw-r--r--src/RequestGroup.cc2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/BtSetup.cc b/src/BtSetup.cc
index 595c2987..31ee458e 100644
--- a/src/BtSetup.cc
+++ b/src/BtSetup.cc
@@ -101,12 +101,12 @@ void BtSetup::setup(std::vector<std::unique_ptr<Command>>& commands,
auto torrentAttrs =
bittorrent::getTorrentAttrs(requestGroup->getDownloadContext());
bool metadataGetMode = torrentAttrs->metadata.empty();
- const std::shared_ptr<BtRegistry>& btReg = e->getBtRegistry();
- const std::shared_ptr<BtObject>& btObject = btReg->get(requestGroup->getGID());
- const std::shared_ptr<PieceStorage>& pieceStorage = btObject->pieceStorage;
- const std::shared_ptr<PeerStorage>& peerStorage = btObject->peerStorage;
- const std::shared_ptr<BtRuntime>& btRuntime = btObject->btRuntime;
- const std::shared_ptr<BtAnnounce>& btAnnounce = btObject->btAnnounce;
+ auto& btReg = e->getBtRegistry();
+ auto& btObject = btReg->get(requestGroup->getGID());
+ auto& pieceStorage = btObject->pieceStorage;
+ auto& peerStorage = btObject->peerStorage;
+ auto& btRuntime = btObject->btRuntime;
+ auto& btAnnounce = btObject->btAnnounce;
// commands
{
auto c = make_unique<TrackerWatcherCommand>(e->newCUID(), requestGroup, e);
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc
index ba7adead..3f5d4484 100644
--- a/src/DownloadEngine.cc
+++ b/src/DownloadEngine.cc
@@ -95,7 +95,7 @@ DownloadEngine::DownloadEngine(const std::shared_ptr<EventPoll>& eventPoll)
lastRefresh_(0),
cookieStorage_(new CookieStorage()),
#ifdef ENABLE_BITTORRENT
- btRegistry_(new BtRegistry()),
+ btRegistry_(make_unique<BtRegistry>()),
#endif // ENABLE_BITTORRENT
#ifdef HAVE_ARES_ADDR_NODE
asyncDNSServers_(0),
diff --git a/src/DownloadEngine.h b/src/DownloadEngine.h
index 75b396f8..4f05204d 100644
--- a/src/DownloadEngine.h
+++ b/src/DownloadEngine.h
@@ -136,7 +136,7 @@ private:
std::unique_ptr<CookieStorage> cookieStorage_;
#ifdef ENABLE_BITTORRENT
- std::shared_ptr<BtRegistry> btRegistry_;
+ std::unique_ptr<BtRegistry> btRegistry_;
#endif // ENABLE_BITTORRENT
CUIDCounter cuidCounter_;
@@ -305,7 +305,7 @@ public:
const std::unique_ptr<CookieStorage>& getCookieStorage() const;
#ifdef ENABLE_BITTORRENT
- const std::shared_ptr<BtRegistry>& getBtRegistry() const
+ const std::unique_ptr<BtRegistry>& getBtRegistry() const
{
return btRegistry_;
}
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc
index ff0ff5bb..aa548611 100644
--- a/src/RequestGroup.cc
+++ b/src/RequestGroup.cc
@@ -289,7 +289,7 @@ void RequestGroup::createInitialCommand
throw DOWNLOAD_FAILURE_EXCEPTION
("Cancel BitTorrent download in dry-run context.");
}
- std::shared_ptr<BtRegistry> btRegistry = e->getBtRegistry();
+ auto& btRegistry = e->getBtRegistry();
if(btRegistry->getDownloadContext(torrentAttrs->infoHash)) {
// TODO If metadataGetMode == false and each FileEntry has
// URI, then go without BT.