Move tcp_config
This commit is contained in:
parent
60a44d6c08
commit
c57e5ea92d
4 changed files with 37 additions and 23 deletions
|
|
@ -164,6 +164,8 @@ add_library(
|
||||||
transport/message_deserializer.cpp
|
transport/message_deserializer.cpp
|
||||||
transport/tcp_channels.hpp
|
transport/tcp_channels.hpp
|
||||||
transport/tcp_channels.cpp
|
transport/tcp_channels.cpp
|
||||||
|
transport/tcp_config.hpp
|
||||||
|
transport/tcp_config.cpp
|
||||||
transport/tcp_listener.hpp
|
transport/tcp_listener.hpp
|
||||||
transport/tcp_listener.cpp
|
transport/tcp_listener.cpp
|
||||||
transport/tcp_server.hpp
|
transport/tcp_server.hpp
|
||||||
|
|
|
||||||
1
nano/node/transport/tcp_config.cpp
Normal file
1
nano/node/transport/tcp_config.cpp
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
#include <nano/node/transport/tcp_config.hpp>
|
||||||
33
nano/node/transport/tcp_config.hpp
Normal file
33
nano/node/transport/tcp_config.hpp
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <nano/lib/config.hpp>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
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 };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <nano/node/endpoint.hpp>
|
#include <nano/node/endpoint.hpp>
|
||||||
#include <nano/node/fwd.hpp>
|
#include <nano/node/fwd.hpp>
|
||||||
#include <nano/node/transport/common.hpp>
|
#include <nano/node/transport/common.hpp>
|
||||||
|
#include <nano/node/transport/tcp_config.hpp>
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
|
|
@ -24,29 +25,6 @@ namespace asio = boost::asio;
|
||||||
|
|
||||||
namespace nano::transport
|
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.
|
* Server side portion of tcp sessions. Listens for new socket connections and spawns tcp_server objects when connected.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue