Skip to content

Commit

Permalink
Fix network.tcp_no_connect_excluded_peers test failure on MacOS (#2750)
Browse files Browse the repository at this point in the history
  • Loading branch information
wezrule authored Apr 29, 2020
1 parent 6f0fbbf commit 5af4a2e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nano/core_test/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
Expand Down
6 changes: 6 additions & 0 deletions nano/node/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions nano/node/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<container_info_component> collect_container_info (std::string const &);
size_t cookies_size ();

private:
class syn_cookie_info final
Expand Down

0 comments on commit 5af4a2e

Please sign in to comment.