Fix network.tcp_no_connect_excluded_peers test failure on MacOS (#2750)

This commit is contained in:
Wesley Shillingford 2020-04-29 21:49:38 +01:00 committed by GitHub
commit 5af4a2e613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -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 ());

View file

@ -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<std::mutex> lock (syn_cookie_mutex);
return cookies.size ();
}
std::unique_ptr<nano::container_info_component> nano::collect_container_info (network & network, const std::string & name)
{
auto composite = std::make_unique<container_info_composite> (name);

View file

@ -99,6 +99,7 @@ public:
// Also removes the syn cookie from the store if valid
bool validate (nano::endpoint const &, nano::account const &, nano::signature const &);
std::unique_ptr<container_info_component> collect_container_info (std::string const &);
size_t cookies_size ();
private:
class syn_cookie_info final