diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index 60740c5da7..aaecbec3da 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -1167,7 +1167,7 @@ TEST (network, purge_dead_channel) auto channel = channels.front (); ASSERT_TRUE (channel); - auto sockets = node1.tcp_listener.sockets (); + auto sockets = node1.tcp_listener.all_sockets (); ASSERT_EQ (sockets.size (), 1); auto socket = sockets.front (); ASSERT_TRUE (socket); @@ -1217,7 +1217,7 @@ TEST (network, purge_dead_channel_remote) auto channel = channels.front (); ASSERT_TRUE (channel); - auto sockets = node1.tcp_listener.sockets (); + auto sockets = node1.tcp_listener.all_sockets (); ASSERT_EQ (sockets.size (), 1); auto socket = sockets.front (); ASSERT_TRUE (socket); diff --git a/nano/core_test/socket.cpp b/nano/core_test/socket.cpp index 68f3cb4eb8..30be470438 100644 --- a/nano/core_test/socket.cpp +++ b/nano/core_test/socket.cpp @@ -107,11 +107,11 @@ TEST (tcp_listener, max_connections) // create space for one socket and fill the connections table again { - auto sockets1 = node->tcp_listener.sockets (); + auto sockets1 = node->tcp_listener.all_sockets (); ASSERT_EQ (sockets1.size (), 2); sockets1[0]->close (); } - ASSERT_TIMELY_EQ (10s, node->tcp_listener.sockets ().size (), 1); + ASSERT_TIMELY_EQ (10s, node->tcp_listener.all_sockets ().size (), 1); auto client4 = std::make_shared (*node); client4->async_connect (node->network.endpoint (), connect_handler); @@ -125,12 +125,12 @@ TEST (tcp_listener, max_connections) // close all existing sockets and fill the connections table again { - auto sockets2 = node->tcp_listener.sockets (); + auto sockets2 = node->tcp_listener.all_sockets (); ASSERT_EQ (sockets2.size (), 2); sockets2[0]->close (); sockets2[1]->close (); } - ASSERT_TIMELY_EQ (10s, node->tcp_listener.sockets ().size (), 0); + ASSERT_TIMELY_EQ (10s, node->tcp_listener.all_sockets ().size (), 0); auto client6 = std::make_shared (*node); client6->async_connect (node->network.endpoint (), connect_handler); diff --git a/nano/node/transport/tcp_listener.cpp b/nano/node/transport/tcp_listener.cpp index 384f60b502..04f13622a7 100644 --- a/nano/node/transport/tcp_listener.cpp +++ b/nano/node/transport/tcp_listener.cpp @@ -564,14 +564,14 @@ asio::ip::tcp::endpoint nano::transport::tcp_listener::endpoint () const return { asio::ip::address_v6::loopback (), local.port () }; } -auto nano::transport::tcp_listener::sockets () const -> std::vector> +auto nano::transport::tcp_listener::all_sockets () const -> std::deque> { nano::lock_guard lock{ mutex }; auto r = connections | std::views::transform ([] (auto const & connection) { return connection.socket; }); return { r.begin (), r.end () }; } -auto nano::transport::tcp_listener::servers () const -> std::vector> +auto nano::transport::tcp_listener::all_servers () const -> std::deque> { nano::lock_guard lock{ mutex }; auto r = connections | std::views::transform ([] (auto const & connection) { return connection.server; }); diff --git a/nano/node/transport/tcp_listener.hpp b/nano/node/transport/tcp_listener.hpp index 37b08d35fe..d592b83b70 100644 --- a/nano/node/transport/tcp_listener.hpp +++ b/nano/node/transport/tcp_listener.hpp @@ -57,8 +57,8 @@ class tcp_listener final size_t realtime_count () const; size_t bootstrap_count () const; - std::vector> sockets () const; - std::vector> servers () const; + std::deque> all_sockets () const; + std::deque> all_servers () const; nano::container_info container_info () const;