Skip to content

Commit

Permalink
SOCKET IS OPEN STRAND
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Apr 17, 2024
1 parent 75bf368 commit 738ed3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions nano/node/transport/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion nano/node/transport/socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class socket final : public std::enable_shared_from_this<nano::transport::socket
}
bool alive () const
{
return !closed && tcp_socket.is_open ();
return !is_closed ();
}

private:
Expand Down

0 comments on commit 738ed3f

Please sign in to comment.