Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tcp_server constructor #4499

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions nano/node/transport/tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ std::unique_ptr<nano::container_info_component> nano::transport::collect_contain
*/

nano::transport::tcp_server::tcp_server (std::shared_ptr<nano::transport::socket> socket_a, std::shared_ptr<nano::node> 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<nano::transport::message_deserializer> (node_a->network_params.network, node_a->network.publish_filter, node_a->block_uniquer, node_a->vote_uniquer,
Expand Down Expand Up @@ -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 ();
}

Expand Down
Loading