From ca9d74f26c7de256db0138770fa9457976eb7878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:26:12 +0100 Subject: [PATCH] Fix `tcp_server` constructor --- nano/node/transport/tcp_server.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nano/node/transport/tcp_server.cpp b/nano/node/transport/tcp_server.cpp index edd7f9663a..e6b81e8e74 100644 --- a/nano/node/transport/tcp_server.cpp +++ b/nano/node/transport/tcp_server.cpp @@ -279,8 +279,8 @@ std::unique_ptr nano::transport::collect_contain */ nano::transport::tcp_server::tcp_server (std::shared_ptr socket_a, std::shared_ptr node_a, bool allow_bootstrap_a) : - socket{ std::move (socket_a) }, - node{ std::move (node_a) }, + socket{ socket_a }, + node{ node_a }, allow_bootstrap{ allow_bootstrap_a }, message_deserializer{ std::make_shared (node_a->network_params.network, node_a->network.publish_filter, node_a->block_uniquer, node_a->vote_uniquer, @@ -335,11 +335,14 @@ void nano::transport::tcp_server::start () debug_assert (remote_endpoint.port () != 0); } - if (auto node_l = node.lock (); node_l) + auto node = this->node.lock (); + if (!node) { - node_l->logger.debug (nano::log::type::tcp_server, "Starting TCP server ({})", nano::util::to_str (remote_endpoint)); + return; } + node->logger.debug (nano::log::type::tcp_server, "Starting TCP server ({})", nano::util::to_str (remote_endpoint)); + receive_message (); }