From fc2c12cc9270b56e3c4c9280cda4cd3d9aa86956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:26:51 +0100 Subject: [PATCH] STATS RENAMING --- nano/core_test/network.cpp | 10 +++++----- nano/core_test/socket.cpp | 20 ++++++++++---------- nano/node/transport/tcp.cpp | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index d5a97da73b..2ceae689e9 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -752,7 +752,7 @@ TEST (network, peer_max_tcp_attempts) } ASSERT_EQ (0, node->network.size ()); ASSERT_FALSE (node->network.tcp_channels.track_reachout (nano::endpoint (node->network.endpoint ().address (), system.get_available_port ()))); - ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::out)); + ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_ip, nano::stat::dir::out)); } #endif @@ -774,9 +774,9 @@ namespace transport ASSERT_TRUE (node->network.tcp_channels.track_reachout (endpoint)); } ASSERT_EQ (0, node->network.size ()); - ASSERT_EQ (0, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::out)); + ASSERT_EQ (0, node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_subnetwork, nano::stat::dir::out)); ASSERT_FALSE (node->network.tcp_channels.track_reachout (nano::endpoint (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"), system.get_available_port ()))); - ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::out)); + ASSERT_EQ (1, node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_subnetwork, nano::stat::dir::out)); } } } @@ -960,9 +960,9 @@ TEST (network, tcp_no_connect_excluded_peers) { node0->network.excluded_peers.add (endpoint1_tcp); } - ASSERT_EQ (0, node0->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_excluded)); + ASSERT_EQ (0, node0->stats.count (nano::stat::type::tcp, nano::stat::detail::excluded)); node1->network.merge_peer (node0->network.endpoint ()); - ASSERT_TIMELY (5s, node0->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_excluded) >= 1); + ASSERT_TIMELY (5s, node0->stats.count (nano::stat::type::tcp, nano::stat::detail::excluded) >= 1); ASSERT_EQ (nullptr, node0->network.find_node_id (node1->get_node_id ())); // Should not actively reachout to excluded peers diff --git a/nano/core_test/socket.cpp b/nano/core_test/socket.cpp index 6071a3c36c..7f90518f71 100644 --- a/nano/core_test/socket.cpp +++ b/nano/core_test/socket.cpp @@ -57,11 +57,11 @@ TEST (socket, max_connections) client3->async_connect (dst_endpoint, connect_handler); auto get_tcp_accept_failures = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_failure, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_failure, nano::stat::dir::in); }; auto get_tcp_accept_successes = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_success, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_success, nano::stat::dir::in); }; ASSERT_TIMELY_EQ (5s, get_tcp_accept_failures (), 1); @@ -152,11 +152,11 @@ TEST (socket, max_connections_per_ip) } auto get_tcp_max_per_ip = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_ip, nano::stat::dir::in); }; auto get_tcp_accept_successes = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_success, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_success, nano::stat::dir::in); }; ASSERT_TIMELY_EQ (5s, get_tcp_accept_successes (), max_ip_connections); @@ -273,11 +273,11 @@ TEST (socket, max_connections_per_subnetwork) } auto get_tcp_max_per_subnetwork = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_subnetwork, nano::stat::dir::in); }; auto get_tcp_accept_successes = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_success, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_success, nano::stat::dir::in); }; ASSERT_TIMELY_EQ (5s, get_tcp_accept_successes (), max_subnetwork_connections); @@ -334,11 +334,11 @@ TEST (socket, disabled_max_peers_per_ip) } auto get_tcp_max_per_ip = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::max_per_ip, nano::stat::dir::in); }; auto get_tcp_accept_successes = [&node] () { - return node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_success, nano::stat::dir::in); + return node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_success, nano::stat::dir::in); }; ASSERT_TIMELY_EQ (5s, get_tcp_accept_successes (), max_ip_connections + 1); @@ -564,9 +564,9 @@ TEST (socket, concurrent_writes) runner.stop_event_processing (); runner.join (); - ASSERT_EQ (node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_success, nano::stat::dir::in), client_count); + ASSERT_EQ (node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_success, nano::stat::dir::in), client_count); // We may exhaust max connections and have some tcp accept failures, but no more than the client count - ASSERT_LT (node->stats.count (nano::stat::type::tcp, nano::stat::detail::tcp_accept_failure, nano::stat::dir::in), client_count); + ASSERT_LT (node->stats.count (nano::stat::type::tcp, nano::stat::detail::accept_failure, nano::stat::dir::in), client_count); for (auto & t : client_threads) { diff --git a/nano/node/transport/tcp.cpp b/nano/node/transport/tcp.cpp index 05ac10d0f1..eac61e5794 100644 --- a/nano/node/transport/tcp.cpp +++ b/nano/node/transport/tcp.cpp @@ -383,7 +383,7 @@ bool nano::transport::tcp_channels::max_ip_connections (nano::tcp_endpoint const } if (result) { - node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_ip, nano::stat::dir::out); + node.stats.inc (nano::stat::type::tcp, nano::stat::detail::max_per_ip, nano::stat::dir::out); } return result; } @@ -404,7 +404,7 @@ bool nano::transport::tcp_channels::max_subnetwork_connections (nano::tcp_endpoi } if (result) { - node.stats.inc (nano::stat::type::tcp, nano::stat::detail::tcp_max_per_subnetwork, nano::stat::dir::out); + node.stats.inc (nano::stat::type::tcp, nano::stat::detail::max_per_subnetwork, nano::stat::dir::out); } return result; }