diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index 4842b42773..de66157331 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -1121,6 +1121,9 @@ TEST (network, tcp_no_connect_excluded_peers) node0->network.excluded_peers.remove (endpoint1_tcp); ASSERT_FALSE (node0->network.excluded_peers.check (endpoint1_tcp)); + // Wait until there is a syn_cookie + ASSERT_TIMELY (5s, node1->network.syn_cookies.cookies_size () != 0); + // Manually cleanup previous attempt node1->network.cleanup (std::chrono::steady_clock::now ()); node1->network.syn_cookies.purge (std::chrono::steady_clock::now ()); diff --git a/nano/node/network.cpp b/nano/node/network.cpp index 8eb1fc7909..4094d4c534 100644 --- a/nano/node/network.cpp +++ b/nano/node/network.cpp @@ -1007,6 +1007,12 @@ void nano::syn_cookies::purge (std::chrono::steady_clock::time_point const & cut } } +size_t nano::syn_cookies::cookies_size () +{ + nano::lock_guard lock (syn_cookie_mutex); + return cookies.size (); +} + std::unique_ptr nano::collect_container_info (network & network, const std::string & name) { auto composite = std::make_unique (name); diff --git a/nano/node/network.hpp b/nano/node/network.hpp index 8b3036549a..9d5945bdca 100644 --- a/nano/node/network.hpp +++ b/nano/node/network.hpp @@ -99,6 +99,7 @@ class syn_cookies final // Also removes the syn cookie from the store if valid bool validate (nano::endpoint const &, nano::account const &, nano::signature const &); std::unique_ptr collect_container_info (std::string const &); + size_t cookies_size (); private: class syn_cookie_info final