diff --git a/nano/node/CMakeLists.txt b/nano/node/CMakeLists.txt index 13a182adf..e37da22bd 100644 --- a/nano/node/CMakeLists.txt +++ b/nano/node/CMakeLists.txt @@ -164,6 +164,8 @@ add_library( transport/message_deserializer.cpp transport/tcp_channels.hpp transport/tcp_channels.cpp + transport/tcp_config.hpp + transport/tcp_config.cpp transport/tcp_listener.hpp transport/tcp_listener.cpp transport/tcp_server.hpp diff --git a/nano/node/transport/tcp_config.cpp b/nano/node/transport/tcp_config.cpp new file mode 100644 index 000000000..8978a9583 --- /dev/null +++ b/nano/node/transport/tcp_config.cpp @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/nano/node/transport/tcp_config.hpp b/nano/node/transport/tcp_config.hpp new file mode 100644 index 000000000..30fc2be84 --- /dev/null +++ b/nano/node/transport/tcp_config.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include + +#include + +namespace nano::transport +{ +class tcp_config +{ +public: + explicit tcp_config (nano::network_constants const & network) + { + if (network.is_dev_network ()) + { + max_inbound_connections = 128; + max_outbound_connections = 128; + max_attempts = 128; + max_attempts_per_ip = 128; + connect_timeout = std::chrono::seconds{ 5 }; + } + } + +public: + size_t max_inbound_connections{ 2048 }; + size_t max_outbound_connections{ 2048 }; + size_t max_attempts{ 60 }; + size_t max_attempts_per_ip{ 1 }; + std::chrono::seconds connect_timeout{ 60 }; + std::chrono::seconds handshake_timeout{ 30 }; + std::chrono::seconds io_timeout{ 30 }; +}; +} \ No newline at end of file diff --git a/nano/node/transport/tcp_listener.hpp b/nano/node/transport/tcp_listener.hpp index b5634b31e..5503d47f7 100644 --- a/nano/node/transport/tcp_listener.hpp +++ b/nano/node/transport/tcp_listener.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -24,29 +25,6 @@ namespace asio = boost::asio; namespace nano::transport { -class tcp_config -{ -public: - explicit tcp_config (nano::network_constants const & network) - { - if (network.is_dev_network ()) - { - max_inbound_connections = 128; - max_outbound_connections = 128; - max_attempts = 128; - max_attempts_per_ip = 128; - connect_timeout = std::chrono::seconds{ 5 }; - } - } - -public: - size_t max_inbound_connections{ 2048 }; - size_t max_outbound_connections{ 2048 }; - size_t max_attempts{ 60 }; - size_t max_attempts_per_ip{ 1 }; - std::chrono::seconds connect_timeout{ 60 }; -}; - /** * Server side portion of tcp sessions. Listens for new socket connections and spawns tcp_server objects when connected. */