From bdb7555f8e12e490bbfdcb126371eb058e864450 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Thu, 17 Jun 2021 10:24:50 +0200 Subject: [PATCH] This test starts several node instances which can be slow to start, especially with TEST_USE_ROCKSDB=1. This would cause connections to be cleaned up before the substantial ASSERTs were checked. (#3336) This adds a flag to disable connection cleanup assuming that all network connections will remain live. --- nano/core_test/network.cpp | 6 +++--- nano/node/network.cpp | 5 ++++- nano/node/nodeconfig.hpp | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index 6b17ef89..01b8e987 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -899,11 +899,11 @@ TEST (network, replace_port) 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; + node_flags.disable_connection_cleanup = true; + nano::system system; + auto node = system.add_node (node_flags); for (auto i (0); i < node->network_params.node.max_peers_per_ip; ++i) { auto node2 (std::make_shared (system.io_ctx, nano::get_available_port (), nano::unique_path (), system.logging, system.work, node_flags)); diff --git a/nano/node/network.cpp b/nano/node/network.cpp index 60ae608d..8c82635c 100644 --- a/nano/node/network.cpp +++ b/nano/node/network.cpp @@ -105,7 +105,10 @@ nano::network::~network () void nano::network::start () { - ongoing_cleanup (); + if (!node.flags.disable_connection_cleanup) + { + ongoing_cleanup (); + } ongoing_syn_cookie_cleanup (); if (!node.flags.disable_udp) { diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index 607febde..07b1f02c 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -148,6 +148,7 @@ public: bool enable_pruning{ false }; bool fast_bootstrap{ false }; bool read_only{ false }; + bool disable_connection_cleanup{ false }; nano::confirmation_height_mode confirmation_height_processor_mode{ nano::confirmation_height_mode::automatic }; nano::generate_cache generate_cache; bool inactive_node{ false };