From 815425f0284c39ac5dcfbc059a6841643019c165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sun, 24 Mar 2024 14:16:37 +0100 Subject: [PATCH] ACCEPT RESULT RENAME --- nano/node/transport/tcp_listener.cpp | 16 ++++++++-------- nano/node/transport/tcp_listener.hpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nano/node/transport/tcp_listener.cpp b/nano/node/transport/tcp_listener.cpp index 94cfb640b4..468d913ec3 100644 --- a/nano/node/transport/tcp_listener.cpp +++ b/nano/node/transport/tcp_listener.cpp @@ -192,13 +192,13 @@ void nano::transport::tcp_listener::run () } } -auto nano::transport::tcp_listener::accept_one () -> check_result +auto nano::transport::tcp_listener::accept_one () -> accept_result { auto boost_socket = acceptor.accept (); auto const remote_endpoint = boost_socket.remote_endpoint (); auto const local_endpoint = boost_socket.local_endpoint (); - if (auto result = check_limits (remote_endpoint.address ()); result != check_result::accepted) + if (auto result = check_limits (remote_endpoint.address ()); result != accept_result::accepted) { stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::accept_limits_exceeded, nano::stat::dir::in); // Refusal reason should be logged earlier @@ -223,7 +223,7 @@ auto nano::transport::tcp_listener::accept_one () -> check_result connection_accepted.notify (socket, server); - return check_result::accepted; + return accept_result::accepted; } void nano::transport::tcp_listener::wait_available_slots () @@ -246,7 +246,7 @@ void nano::transport::tcp_listener::wait_available_slots () } } -auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const & ip) -> check_result +auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const & ip) -> accept_result { nano::lock_guard lock{ mutex }; @@ -261,7 +261,7 @@ auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::max_per_ip, nano::stat::dir::in); logger.debug (nano::log::type::tcp_listener, "Max connections per IP reached ({}), unable to open new connection", ip.to_string ()); - return check_result::too_many_per_ip; + return accept_result::too_many_per_ip; } } @@ -273,7 +273,7 @@ auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::max_per_subnetwork, nano::stat::dir::in); logger.debug (nano::log::type::tcp_listener, "Max connections per subnetwork reached ({}), unable to open new connection", ip.to_string ()); - return check_result::too_many_per_subnetwork; + return accept_result::too_many_per_subnetwork; } } @@ -282,10 +282,10 @@ auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const stats.inc (nano::stat::type::tcp_listener, nano::stat::detail::excluded, nano::stat::dir::in); logger.debug (nano::log::type::tcp_listener, "Rejected connection from excluded peer: {}", ip.to_string ()); - return check_result::excluded; + return accept_result::excluded; } - return check_result::accepted; + return accept_result::accepted; } size_t nano::transport::tcp_listener::connection_count () const diff --git a/nano/node/transport/tcp_listener.hpp b/nano/node/transport/tcp_listener.hpp index a2440b0d7d..33652b4b15 100644 --- a/nano/node/transport/tcp_listener.hpp +++ b/nano/node/transport/tcp_listener.hpp @@ -58,7 +58,7 @@ class tcp_listener final void cleanup (); void wait_available_slots (); - enum class check_result + enum class accept_result { invalid, accepted, @@ -67,8 +67,8 @@ class tcp_listener final excluded, }; - check_result accept_one (); - check_result check_limits (boost::asio::ip::address const & ip); + accept_result accept_one (); + accept_result check_limits (boost::asio::ip::address const & ip); size_t count_per_ip (boost::asio::ip::address const & ip) const; size_t count_per_subnetwork (boost::asio::ip::address const & ip) const;