MultiplexedSocket: add logger argument
Change-Id: I1c872351cf3f0e519595ab8d734db2841d7d2218
diff --git a/include/multiplexed_socket.h b/include/multiplexed_socket.h
index a090a8c..e265db9 100644
--- a/include/multiplexed_socket.h
+++ b/include/multiplexed_socket.h
@@ -79,7 +79,7 @@
class MultiplexedSocket : public std::enable_shared_from_this<MultiplexedSocket>
{
public:
- MultiplexedSocket(std::shared_ptr<asio::io_context> ctx, const DeviceId& deviceId, std::unique_ptr<TlsSocketEndpoint> endpoint);
+ MultiplexedSocket(std::shared_ptr<asio::io_context> ctx, const DeviceId& deviceId, std::unique_ptr<TlsSocketEndpoint> endpoint, std::shared_ptr<dht::log::Logger> logger = {});
~MultiplexedSocket();
std::shared_ptr<ChannelSocket> addChannel(const std::string& name);
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 2b6e544..f852661 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -1256,7 +1256,7 @@
void
ConnectionManager::Impl::addNewMultiplexedSocket(const CallbackId& id, const std::shared_ptr<ConnectionInfo>& info)
{
- info->socket_ = std::make_shared<MultiplexedSocket>(config_->ioContext, id.first, std::move(info->tls_));
+ info->socket_ = std::make_shared<MultiplexedSocket>(config_->ioContext, id.first, std::move(info->tls_), config_->logger);
info->socket_->setOnReady(
[w = weak()](const DeviceId& deviceId, const std::shared_ptr<ChannelSocket>& socket) {
if (auto sthis = w.lock())
diff --git a/src/multiplexed_socket.cpp b/src/multiplexed_socket.cpp
index 28e5c11..154741b 100644
--- a/src/multiplexed_socket.cpp
+++ b/src/multiplexed_socket.cpp
@@ -60,7 +60,8 @@
Impl(MultiplexedSocket& parent,
std::shared_ptr<asio::io_context> ctx,
const DeviceId& deviceId,
- std::unique_ptr<TlsSocketEndpoint> endpoint)
+ std::unique_ptr<TlsSocketEndpoint> endpoint,
+ std::shared_ptr<dht::log::Logger> logger)
: parent_(parent)
, ctx_(std::move(ctx))
, deviceId(deviceId)
@@ -541,8 +542,8 @@
}
MultiplexedSocket::MultiplexedSocket(std::shared_ptr<asio::io_context> ctx, const DeviceId& deviceId,
- std::unique_ptr<TlsSocketEndpoint> endpoint)
- : pimpl_(std::make_unique<Impl>(*this, ctx, deviceId, std::move(endpoint)))
+ std::unique_ptr<TlsSocketEndpoint> endpoint, std::shared_ptr<dht::log::Logger> logger)
+ : pimpl_(std::make_unique<Impl>(*this, ctx, deviceId, std::move(endpoint), logger))
{}
MultiplexedSocket::~MultiplexedSocket() {}