From 738ed3f64f0250418248f73fbea5f09d0bcfb356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:04:32 +0200 Subject: [PATCH] SOCKET IS OPEN STRAND --- nano/node/transport/socket.cpp | 13 +++++++------ nano/node/transport/socket.hpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nano/node/transport/socket.cpp b/nano/node/transport/socket.cpp index 3e57256e91..bc6b25db36 100644 --- a/nano/node/transport/socket.cpp +++ b/nano/node/transport/socket.cpp @@ -37,6 +37,7 @@ nano::transport::socket::socket (nano::node & node_a, endpoint_type_t endpoint_t nano::transport::socket::~socket () { close_internal (); + closed = true; } void nano::transport::socket::start () @@ -280,12 +281,12 @@ void nano::transport::socket::ongoing_checkup () return; } - // If the socket is already dead, close just in case, and stop doing checkups - if (!this_l->alive ()) - { - this_l->close (); - return; - } + boost::asio::post (this_l->strand, [this_l] { + if (!this_l->tcp_socket.is_open ()) + { + this_l->close (); + } + }); nano::seconds_t now = nano::seconds_since_epoch (); auto condition_to_disconnect{ false }; diff --git a/nano/node/transport/socket.hpp b/nano/node/transport/socket.hpp index 6a563e51fa..e3b52d50ce 100644 --- a/nano/node/transport/socket.hpp +++ b/nano/node/transport/socket.hpp @@ -116,7 +116,7 @@ class socket final : public std::enable_shared_from_this