mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02: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
|
@ -282,9 +282,14 @@ namespace tunnel
|
|||
for (const auto& it : m_OutboundTunnels)
|
||||
if (it->IsEstablished ()) num++;
|
||||
}
|
||||
for (int i = num; i < m_NumOutboundTunnels; i++)
|
||||
CreateOutboundTunnel ();
|
||||
|
||||
num = m_NumOutboundTunnels - num;
|
||||
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;
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
|
@ -300,9 +305,14 @@ namespace tunnel
|
|||
if (num >= m_NumInboundTunnels) break;
|
||||
}
|
||||
}
|
||||
for (int i = num; i < m_NumInboundTunnels; i++)
|
||||
CreateInboundTunnel ();
|
||||
|
||||
num = m_NumInboundTunnels - num;
|
||||
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
|
||||
m_LocalDestination->SetLeaseSetUpdated (); // update LeaseSet immediately
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue