Cleanup config
This commit is contained in:
parent
c57e5ea92d
commit
11675c2e0e
7 changed files with 8 additions and 10 deletions
|
|
@ -118,7 +118,7 @@ TEST (network, last_contacted)
|
|||
ASSERT_EQ (0, node0->network.size ());
|
||||
|
||||
nano::node_config node1_config = system.default_config ();
|
||||
node1_config.tcp_incoming_connections_max = 0; // Prevent ephemeral node1->node0 channel repacement with incoming connection
|
||||
node1_config.tcp.max_inbound_connections = 0; // Prevent ephemeral node1->node0 channel repacement with incoming connection
|
||||
auto node1 (std::make_shared<nano::node> (system.io_ctx, nano::unique_path (), node1_config, system.work));
|
||||
node1->start ();
|
||||
system.nodes.push_back (node1);
|
||||
|
|
|
|||
|
|
@ -2603,7 +2603,7 @@ TEST (node, bidirectional_tcp)
|
|||
node_config.backlog_scan.enable = false;
|
||||
auto node1 = system.add_node (node_config, node_flags);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
node_config.tcp_incoming_connections_max = 0; // Disable incoming TCP connections for node 2
|
||||
node_config.tcp.max_inbound_connections = 0; // Disable incoming TCP connections for node 2
|
||||
auto node2 = system.add_node (node_config, node_flags);
|
||||
// Check network connections
|
||||
ASSERT_EQ (1, node1->network.size ());
|
||||
|
|
|
|||
|
|
@ -305,7 +305,6 @@ TEST (toml_config, daemon_config_deserialize_defaults)
|
|||
ASSERT_EQ (conf.node.preconfigured_representatives, defaults.node.preconfigured_representatives);
|
||||
ASSERT_EQ (conf.node.receive_minimum, defaults.node.receive_minimum);
|
||||
ASSERT_EQ (conf.node.signature_checker_threads, defaults.node.signature_checker_threads);
|
||||
ASSERT_EQ (conf.node.tcp_incoming_connections_max, defaults.node.tcp_incoming_connections_max);
|
||||
ASSERT_EQ (conf.node.tcp_io_timeout, defaults.node.tcp_io_timeout);
|
||||
ASSERT_EQ (conf.node.unchecked_cutoff_time, defaults.node.unchecked_cutoff_time);
|
||||
ASSERT_EQ (conf.node.use_memory_pools, defaults.node.use_memory_pools);
|
||||
|
|
@ -458,7 +457,6 @@ TEST (toml_config, daemon_config_deserialize_no_defaults)
|
|||
preconfigured_representatives = ["nano_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4"]
|
||||
receive_minimum = "999"
|
||||
signature_checker_threads = 999
|
||||
tcp_incoming_connections_max = 999
|
||||
tcp_io_timeout = 999
|
||||
unchecked_cutoff_time = 999
|
||||
use_memory_pools = false
|
||||
|
|
@ -710,7 +708,6 @@ TEST (toml_config, daemon_config_deserialize_no_defaults)
|
|||
ASSERT_NE (conf.node.preconfigured_representatives, defaults.node.preconfigured_representatives);
|
||||
ASSERT_NE (conf.node.receive_minimum, defaults.node.receive_minimum);
|
||||
ASSERT_NE (conf.node.signature_checker_threads, defaults.node.signature_checker_threads);
|
||||
ASSERT_NE (conf.node.tcp_incoming_connections_max, defaults.node.tcp_incoming_connections_max);
|
||||
ASSERT_NE (conf.node.tcp_io_timeout, defaults.node.tcp_io_timeout);
|
||||
ASSERT_NE (conf.node.unchecked_cutoff_time, defaults.node.unchecked_cutoff_time);
|
||||
ASSERT_NE (conf.node.use_memory_pools, defaults.node.use_memory_pools);
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ void nano::node::start ()
|
|||
}
|
||||
|
||||
bool tcp_enabled = false;
|
||||
if (config.tcp_incoming_connections_max > 0 && !(flags.disable_bootstrap_listener && flags.disable_tcp_realtime))
|
||||
if (!(flags.disable_bootstrap_listener && flags.disable_tcp_realtime))
|
||||
{
|
||||
tcp_listener.start ();
|
||||
tcp_enabled = true;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const
|
|||
toml.put ("pow_sleep_interval", pow_sleep_interval.count (), "Time to sleep between batch work generation attempts. Reduces max CPU usage at the expense of a longer generation time.\ntype:nanoseconds");
|
||||
toml.put ("external_address", external_address, "The external address of this node (NAT). If not set, the node will request this information via UPnP.\ntype:string,ip");
|
||||
toml.put ("external_port", external_port, "The external port number of this node (NAT). Only used if external_address is set.\ntype:uint16");
|
||||
toml.put ("tcp_incoming_connections_max", tcp_incoming_connections_max, "Maximum number of incoming TCP connections.\ntype:uint64");
|
||||
toml.put ("use_memory_pools", use_memory_pools, "If true, allocate memory from memory pools. Enabling this may improve performance. Memory is never released to the OS.\ntype:bool");
|
||||
|
||||
toml.put ("bandwidth_limit", bandwidth_limit, "Outbound traffic limit in bytes/sec after which messages will be dropped.\nNote: changing to unlimited bandwidth (0) is not recommended for limited connections.\ntype:uint64");
|
||||
|
|
@ -538,7 +537,6 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
toml.get<boost::asio::ip::address_v6> ("external_address", external_address_l);
|
||||
external_address = external_address_l.to_string ();
|
||||
toml.get<uint16_t> ("external_port", external_port);
|
||||
toml.get<unsigned> ("tcp_incoming_connections_max", tcp_incoming_connections_max);
|
||||
|
||||
auto pow_sleep_interval_l (pow_sleep_interval.count ());
|
||||
toml.get (pow_sleep_interval_key, pow_sleep_interval_l);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <nano/node/scheduler/hinted.hpp>
|
||||
#include <nano/node/scheduler/optimistic.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/node/transport/tcp_config.hpp>
|
||||
#include <nano/node/transport/tcp_listener.hpp>
|
||||
#include <nano/node/vote_cache.hpp>
|
||||
#include <nano/node/vote_processor.hpp>
|
||||
|
|
@ -109,8 +110,6 @@ public:
|
|||
std::chrono::seconds tcp_io_timeout{ (network_params.network.is_dev_network () && !is_sanitizer_build ()) ? std::chrono::seconds (5) : std::chrono::seconds (15) };
|
||||
std::chrono::nanoseconds pow_sleep_interval{ 0 };
|
||||
|
||||
/** Default maximum incoming TCP connections, including realtime network & bootstrap */
|
||||
unsigned tcp_incoming_connections_max{ 2048 };
|
||||
bool use_memory_pools{ true };
|
||||
static std::chrono::minutes constexpr wallet_backup_interval = std::chrono::minutes (5);
|
||||
/** Default outbound traffic shaping is 10MB/s */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/config.hpp>
|
||||
#include <nano/lib/constants.hpp>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
|
|
@ -21,6 +22,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// TODO: Serialize/deserialize
|
||||
|
||||
public:
|
||||
size_t max_inbound_connections{ 2048 };
|
||||
size_t max_outbound_connections{ 2048 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue