mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
make ntcp worker threads configurable in number
This commit is contained in:
parent
547a0057e6
commit
b469080cd7
@ -73,6 +73,7 @@ namespace config {
|
||||
("limits.transittunnels", value<uint16_t>()->default_value(2500), "Maximum active transit sessions (default:2500)")
|
||||
("limits.ntcpsoft", value<uint16_t>()->default_value(0), "Threshold to start probabalistic backoff with ntcp sessions (default: use system limit)")
|
||||
("limits.ntcphard", value<uint16_t>()->default_value(0), "Maximum number of ntcp sessions (default: use system limit)")
|
||||
("limits.ntcpthreads", value<uint16_t>()->default_value(1), "Maximum number of threads used by NTCP DH worker (default: 1)")
|
||||
;
|
||||
|
||||
options_description httpserver("HTTP Server options");
|
||||
|
@ -153,9 +153,10 @@ namespace transport
|
||||
m_Thread = new std::thread (std::bind (&Transports::Run, this));
|
||||
std::string ntcpproxy; i2p::config::GetOption("ntcpproxy", ntcpproxy);
|
||||
i2p::http::URL proxyurl;
|
||||
uint16_t softLimit, hardLimit;
|
||||
uint16_t softLimit, hardLimit, threads;
|
||||
i2p::config::GetOption("limits.ntcpsoft", softLimit);
|
||||
i2p::config::GetOption("limits.ntcphard", hardLimit);
|
||||
i2p::config::GetOption("limits.ntcpthreads", threads);
|
||||
if(softLimit > 0 && hardLimit > 0 && softLimit >= hardLimit)
|
||||
{
|
||||
LogPrint(eLogError, "ntcp soft limit must be less than ntcp hard limit");
|
||||
@ -167,7 +168,7 @@ namespace transport
|
||||
{
|
||||
if(proxyurl.schema == "socks" || proxyurl.schema == "http")
|
||||
{
|
||||
m_NTCPServer = new NTCPServer();
|
||||
m_NTCPServer = new NTCPServer(threads);
|
||||
m_NTCPServer->SetSessionLimits(softLimit, hardLimit);
|
||||
NTCPServer::ProxyType proxytype = NTCPServer::eSocksProxy;
|
||||
|
||||
@ -198,7 +199,7 @@ namespace transport
|
||||
if (!address) continue;
|
||||
if (m_NTCPServer == nullptr && enableNTCP)
|
||||
{
|
||||
m_NTCPServer = new NTCPServer ();
|
||||
m_NTCPServer = new NTCPServer (threads);
|
||||
m_NTCPServer->SetSessionLimits(softLimit, hardLimit);
|
||||
m_NTCPServer->Start ();
|
||||
if (!(m_NTCPServer->IsBoundV6() || m_NTCPServer->IsBoundV4())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user