Skip to content

Commit

Permalink
Add test network.peer_max_tcp_attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
SergiySW committed Feb 24, 2020
1 parent 3adede2 commit fc4a462
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nano/core_test/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,25 @@ TEST (network, replace_port)
node1->stop ();
}

TEST (network, peer_max_tcp_attempts)
{
nano::system system (1);
auto node (system.nodes[0]);
// Add nodes that can accept TCP connection, but not node ID handshake
nano::node_flags node_flags;
node_flags.disable_tcp_realtime = true;
for (auto i (0); i < nano::transport::max_peers_per_ip; ++i)
{
auto node2 (std::make_shared<nano::node> (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.alarm, system.logging, system.work, node_flags));
node2->start ();
system.nodes.push_back (node2);
// Start TCP attempt
node->network.merge_peer (node2->network.endpoint ());
}
ASSERT_EQ (0, node->network.size ());
ASSERT_TRUE (node->network.tcp_channels.reachout (nano::endpoint (node->network.endpoint ().address (), nano::get_available_port ())));
}

// The test must be completed in less than 1 second
TEST (bandwidth_limiter, validate)
{
Expand Down

0 comments on commit fc4a462

Please sign in to comment.