mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-21 16:49:10 +01:00
ilimit umner of simultaneous tunnel build requests per pool
This commit is contained in:
parent
84d6028454
commit
cb139226df
4 changed files with 19 additions and 8 deletions
|
@ -516,7 +516,7 @@ namespace tunnel
|
||||||
LogPrint (eLogWarning, "Tunnel: Unexpected message type ", (int) typeID);
|
LogPrint (eLogWarning, "Tunnel: Unexpected message type ", (int) typeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = (numMsgs <= MAX_NUM_TUNNEL_MSGS_AT_THE_TIME) ? m_Queue.Get () : nullptr;
|
msg = (numMsgs <= MAX_TUNNEL_MSGS_BATCH_SIZE) ? m_Queue.Get () : nullptr;
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
prevTunnelID = tunnelID;
|
prevTunnelID = tunnelID;
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace tunnel
|
||||||
const int STANDARD_NUM_RECORDS = 4; // in VariableTunnelBuild message
|
const int STANDARD_NUM_RECORDS = 4; // in VariableTunnelBuild message
|
||||||
const int MAX_NUM_RECORDS = 8;
|
const int MAX_NUM_RECORDS = 8;
|
||||||
const int HIGH_LATENCY_PER_HOP = 250; // in milliseconds
|
const int HIGH_LATENCY_PER_HOP = 250; // in milliseconds
|
||||||
const int MAX_NUM_TUNNEL_MSGS_AT_THE_TIME = 100; // handle message without break
|
const int MAX_TUNNEL_MSGS_BATCH_SIZE = 100; // handle messages without interrupt
|
||||||
const int TUNNEL_MANAGE_INTERVAL = 15; // in seconds
|
const int TUNNEL_MANAGE_INTERVAL = 15; // in seconds
|
||||||
const int TUNNEL_POOLS_MANAGE_INTERVAL = 5; // in seconds
|
const int TUNNEL_POOLS_MANAGE_INTERVAL = 5; // in seconds
|
||||||
const int TUNNEL_MEMORY_POOL_MANAGE_INTERVAL = 120; // in seconds
|
const int TUNNEL_MEMORY_POOL_MANAGE_INTERVAL = 120; // in seconds
|
||||||
|
|
|
@ -282,8 +282,13 @@ namespace tunnel
|
||||||
for (const auto& it : m_OutboundTunnels)
|
for (const auto& it : m_OutboundTunnels)
|
||||||
if (it->IsEstablished ()) num++;
|
if (it->IsEstablished ()) num++;
|
||||||
}
|
}
|
||||||
for (int i = num; i < m_NumOutboundTunnels; i++)
|
num = m_NumOutboundTunnels - num;
|
||||||
CreateOutboundTunnel ();
|
if (num > 0)
|
||||||
|
{
|
||||||
|
if (num > TUNNEL_POOL_MAX_NUM_BUILD_REQUESTS) num = TUNNEL_POOL_MAX_NUM_BUILD_REQUESTS;
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
CreateOutboundTunnel ();
|
||||||
|
}
|
||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
{
|
{
|
||||||
|
@ -300,8 +305,13 @@ namespace tunnel
|
||||||
if (num >= m_NumInboundTunnels) break;
|
if (num >= m_NumInboundTunnels) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = num; i < m_NumInboundTunnels; i++)
|
num = m_NumInboundTunnels - num;
|
||||||
CreateInboundTunnel ();
|
if (num > 0)
|
||||||
|
{
|
||||||
|
if (num > TUNNEL_POOL_MAX_NUM_BUILD_REQUESTS) num = TUNNEL_POOL_MAX_NUM_BUILD_REQUESTS;
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
CreateInboundTunnel ();
|
||||||
|
}
|
||||||
|
|
||||||
if (num < m_NumInboundTunnels && m_NumInboundHops <= 0 && m_LocalDestination) // zero hops IB
|
if (num < m_NumInboundTunnels && m_NumInboundHops <= 0 && m_LocalDestination) // zero hops IB
|
||||||
m_LocalDestination->SetLeaseSetUpdated (); // update LeaseSet immediately
|
m_LocalDestination->SetLeaseSetUpdated (); // update LeaseSet immediately
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace tunnel
|
||||||
const int TUNNEL_POOL_MANAGE_INTERVAL = 10; // in seconds
|
const int TUNNEL_POOL_MANAGE_INTERVAL = 10; // in seconds
|
||||||
const int TUNNEL_POOL_MAX_INBOUND_TUNNELS_QUANTITY = 16;
|
const int TUNNEL_POOL_MAX_INBOUND_TUNNELS_QUANTITY = 16;
|
||||||
const int TUNNEL_POOL_MAX_OUTBOUND_TUNNELS_QUANTITY = 16;
|
const int TUNNEL_POOL_MAX_OUTBOUND_TUNNELS_QUANTITY = 16;
|
||||||
|
const int TUNNEL_POOL_MAX_NUM_BUILD_REQUESTS = 2;
|
||||||
|
|
||||||
class Tunnel;
|
class Tunnel;
|
||||||
class InboundTunnel;
|
class InboundTunnel;
|
||||||
|
|
Loading…
Add table
Reference in a new issue