Skip to content

Commit

Permalink
STATS RENAMING
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Mar 22, 2024
1 parent 25ba42f commit fc2c12c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions nano/core_test/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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));
}
}
}
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions nano/core_test/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions nano/node/transport/tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit fc2c12c

Please sign in to comment.