Skip to content
Snippets Groups Projects
Commit 5636f7cb authored by Adrien Béraud's avatar Adrien Béraud
Browse files

MultiplexedSocket: add logger argument

Change-Id: I1c872351cf3f0e519595ab8d734db2841d7d2218
parent 6a529fb3
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,7 @@ struct ChannelRequest ...@@ -79,7 +79,7 @@ struct ChannelRequest
class MultiplexedSocket : public std::enable_shared_from_this<MultiplexedSocket> class MultiplexedSocket : public std::enable_shared_from_this<MultiplexedSocket>
{ {
public: 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(); ~MultiplexedSocket();
std::shared_ptr<ChannelSocket> addChannel(const std::string& name); std::shared_ptr<ChannelSocket> addChannel(const std::string& name);
......
...@@ -1256,7 +1256,7 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req, ...@@ -1256,7 +1256,7 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req,
void void
ConnectionManager::Impl::addNewMultiplexedSocket(const CallbackId& id, const std::shared_ptr<ConnectionInfo>& info) 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( info->socket_->setOnReady(
[w = weak()](const DeviceId& deviceId, const std::shared_ptr<ChannelSocket>& socket) { [w = weak()](const DeviceId& deviceId, const std::shared_ptr<ChannelSocket>& socket) {
if (auto sthis = w.lock()) if (auto sthis = w.lock())
......
...@@ -60,7 +60,8 @@ public: ...@@ -60,7 +60,8 @@ public:
Impl(MultiplexedSocket& parent, Impl(MultiplexedSocket& parent,
std::shared_ptr<asio::io_context> ctx, std::shared_ptr<asio::io_context> ctx,
const DeviceId& deviceId, const DeviceId& deviceId,
std::unique_ptr<TlsSocketEndpoint> endpoint) std::unique_ptr<TlsSocketEndpoint> endpoint,
std::shared_ptr<dht::log::Logger> logger)
: parent_(parent) : parent_(parent)
, ctx_(std::move(ctx)) , ctx_(std::move(ctx))
, deviceId(deviceId) , deviceId(deviceId)
...@@ -541,8 +542,8 @@ MultiplexedSocket::Impl::handleProtocolPacket(std::vector<uint8_t>&& pkt) ...@@ -541,8 +542,8 @@ MultiplexedSocket::Impl::handleProtocolPacket(std::vector<uint8_t>&& pkt)
} }
MultiplexedSocket::MultiplexedSocket(std::shared_ptr<asio::io_context> ctx, const DeviceId& deviceId, MultiplexedSocket::MultiplexedSocket(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)
: pimpl_(std::make_unique<Impl>(*this, ctx, deviceId, std::move(endpoint))) : pimpl_(std::make_unique<Impl>(*this, ctx, deviceId, std::move(endpoint), logger))
{} {}
MultiplexedSocket::~MultiplexedSocket() {} MultiplexedSocket::~MultiplexedSocket() {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment