summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/DHTInteractionCommand.cc4
-rw-r--r--src/DHTInteractionCommand.h4
-rw-r--r--src/DHTMessageReceiver.cc6
-rw-r--r--src/DHTMessageReceiver.h10
-rw-r--r--src/DHTSetup.cc5
5 files changed, 6 insertions, 23 deletions
diff --git a/src/DHTInteractionCommand.cc b/src/DHTInteractionCommand.cc
index fe193cd4..f39c4803 100644
--- a/src/DHTInteractionCommand.cc
+++ b/src/DHTInteractionCommand.cc
@@ -162,9 +162,9 @@ void DHTInteractionCommand::setTaskQueue(DHTTaskQueue* taskQueue)
}
void DHTInteractionCommand::setConnection
-(const std::shared_ptr<DHTConnection>& connection)
+(std::unique_ptr<DHTConnection> connection)
{
- connection_ = connection;
+ connection_ = std::move(connection);
}
void DHTInteractionCommand::setUDPTrackerClient
diff --git a/src/DHTInteractionCommand.h b/src/DHTInteractionCommand.h
index c53c4084..f2ebaea3 100644
--- a/src/DHTInteractionCommand.h
+++ b/src/DHTInteractionCommand.h
@@ -56,7 +56,7 @@ private:
DHTMessageReceiver* receiver_;
DHTTaskQueue* taskQueue_;
std::shared_ptr<SocketCore> readCheckSocket_;
- std::shared_ptr<DHTConnection> connection_;
+ std::unique_ptr<DHTConnection> connection_;
std::shared_ptr<UDPTrackerClient> udpTrackerClient_;
public:
DHTInteractionCommand(cuid_t cuid, DownloadEngine* e);
@@ -75,7 +75,7 @@ public:
void setTaskQueue(DHTTaskQueue* taskQueue);
- void setConnection(const std::shared_ptr<DHTConnection>& connection);
+ void setConnection(std::unique_ptr<DHTConnection> connection);
void setUDPTrackerClient
(const std::shared_ptr<UDPTrackerClient>& udpTrackerClient);
diff --git a/src/DHTMessageReceiver.cc b/src/DHTMessageReceiver.cc
index b6c2cf49..d70e0245 100644
--- a/src/DHTMessageReceiver.cc
+++ b/src/DHTMessageReceiver.cc
@@ -38,7 +38,6 @@
#include <utility>
#include "DHTMessageTracker.h"
-#include "DHTConnection.h"
#include "DHTMessage.h"
#include "DHTQueryMessage.h"
#include "DHTResponseMessage.h"
@@ -143,11 +142,6 @@ DHTMessageReceiver::handleUnknownMessage(const unsigned char* data,
return m;
}
-void DHTMessageReceiver::setConnection(const std::shared_ptr<DHTConnection>& connection)
-{
- connection_ = connection;
-}
-
void DHTMessageReceiver::setMessageFactory(DHTMessageFactory* factory)
{
factory_ = factory;
diff --git a/src/DHTMessageReceiver.h b/src/DHTMessageReceiver.h
index 04f5885b..3093193e 100644
--- a/src/DHTMessageReceiver.h
+++ b/src/DHTMessageReceiver.h
@@ -44,7 +44,6 @@ namespace aria2 {
class DHTMessageTracker;
class DHTMessage;
-class DHTConnection;
class DHTMessageFactory;
class DHTRoutingTable;
class DHTUnknownMessage;
@@ -53,8 +52,6 @@ class DHTMessageReceiver {
private:
std::shared_ptr<DHTMessageTracker> tracker_;
- std::shared_ptr<DHTConnection> connection_;
-
DHTMessageFactory* factory_;
DHTRoutingTable* routingTable_;
@@ -73,18 +70,11 @@ public:
void handleTimeout();
- const std::shared_ptr<DHTConnection>& getConnection() const
- {
- return connection_;
- }
-
const std::shared_ptr<DHTMessageTracker>& getMessageTracker() const
{
return tracker_;
}
- void setConnection(const std::shared_ptr<DHTConnection>& connection);
-
void setMessageFactory(DHTMessageFactory* factory);
void setRoutingTable(DHTRoutingTable* routingTable);
diff --git a/src/DHTSetup.cc b/src/DHTSetup.cc
index c65baf97..89fff38a 100644
--- a/src/DHTSetup.cc
+++ b/src/DHTSetup.cc
@@ -111,7 +111,7 @@ std::vector<std::unique_ptr<Command>> DHTSetup::setup
}
uint16_t port;
- auto connection = std::make_shared<DHTConnectionImpl>(family);
+ auto connection = make_unique<DHTConnectionImpl>(family);
{
port = e->getBtRegistry()->getUdpPort();
const std::string& addr =
@@ -156,7 +156,6 @@ std::vector<std::unique_ptr<Command>> DHTSetup::setup
dispatcher->setTimeout(messageTimeout);
- receiver->setConnection(connection);
receiver->setMessageFactory(factory.get());
receiver->setRoutingTable(routingTable.get());
@@ -210,7 +209,7 @@ std::vector<std::unique_ptr<Command>> DHTSetup::setup
command->setMessageReceiver(receiver.get());
command->setTaskQueue(taskQueue.get());
command->setReadCheckSocket(connection->getSocket());
- command->setConnection(connection);
+ command->setConnection(std::move(connection));
command->setUDPTrackerClient(udpTrackerClient);
tempCommands.push_back(std::move(command));
}