Skip to content

Commit

Permalink
stop modification
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0vity committed Mar 26, 2024
1 parent 8b9c36a commit 5671ccd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions nano/node/transport/tcp_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void nano::transport::tcp_listener::stop ()
}
condition.notify_all ();

acceptor.cancel(); // Cancel any outstanding asynchronous operations
acceptor.close ();

if (thread.joinable ())
Expand Down Expand Up @@ -173,11 +174,15 @@ void nano::transport::tcp_listener::run ()
}
catch (boost::system::system_error const & ex)
{
stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::accept_error, nano::stat::dir::in);
logger.log (stopped ? nano::log::level::debug : nano::log::level::error, // Avoid logging expected errors when stopping
nano::log::type::tcp_listener, "Error accepting incoming connection: {}", ex.what ());
if (ex.code() != boost::asio::error::operation_aborted)
{
stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::accept_error, nano::stat::dir::in);
logger.log (stopped ? nano::log::level::debug : nano::log::level::error, // Avoid logging expected errors when stopping
nano::log::type::tcp_listener, "Error accepting incoming connection: {}", ex.what ());

cooldown = true;
cooldown = true;
}

}

lock.lock ();
Expand Down

0 comments on commit 5671ccd

Please sign in to comment.