# Conflicts:
#	nano/core_test/socket.cpp
This commit is contained in:
Piotr Wójcik 2024-11-21 13:02:22 +01:00
commit 5bb0ac41b5
4 changed files with 10 additions and 10 deletions

View file

@ -1083,7 +1083,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);
@ -1133,7 +1133,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);

View file

@ -48,11 +48,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<nano::transport::tcp_socket> (*node);
client4->async_connect (node->network.endpoint (), connect_handler);
@ -66,12 +66,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<nano::transport::tcp_socket> (*node);
client6->async_connect (node->network.endpoint (), connect_handler);

View file

@ -585,7 +585,7 @@ 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<std::shared_ptr<tcp_socket>>
auto nano::transport::tcp_listener::all_sockets () const -> std::deque<std::shared_ptr<tcp_socket>>
{
nano::lock_guard<nano::mutex> lock{ mutex };
auto r = connections
@ -594,7 +594,7 @@ auto nano::transport::tcp_listener::sockets () const -> std::vector<std::shared_
return { r.begin (), r.end () };
}
auto nano::transport::tcp_listener::servers () const -> std::vector<std::shared_ptr<tcp_server>>
auto nano::transport::tcp_listener::all_servers () const -> std::deque<std::shared_ptr<tcp_server>>
{
nano::lock_guard<nano::mutex> lock{ mutex };
auto r = connections

View file

@ -71,8 +71,8 @@ public:
size_t realtime_count () const;
size_t bootstrap_count () const;
std::vector<std::shared_ptr<tcp_socket>> sockets () const;
std::vector<std::shared_ptr<tcp_server>> servers () const;
std::deque<std::shared_ptr<tcp_socket>> all_sockets () const;
std::deque<std::shared_ptr<tcp_server>> all_servers () const;
nano::container_info container_info () const;