outbound tunnel pool

This commit is contained in:
orignal 2014-03-16 16:03:20 -04:00
parent 9ef8ae99e2
commit c9ba7da0b0
6 changed files with 74 additions and 7 deletions

View file

@ -390,13 +390,16 @@ namespace tunnel
if (ts > (*it)->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
{
LogPrint ("Tunnel ", (*it)->GetTunnelID (), " expired");
auto pool = (*it)->GetTunnelPool ();
if (pool)
pool->TunnelExpired (*it);
it = m_OutboundTunnels.erase (it);
}
else
it++;
}
if (m_OutboundTunnels.size () < 10)
if (m_OutboundTunnels.size () < 15) // TODO: store exploratory tunnels explicitly
{
// trying to create one more oubound tunnel
if (m_InboundTunnels.empty ()) return;
@ -520,6 +523,9 @@ namespace tunnel
void Tunnels::AddOutboundTunnel (OutboundTunnel * newTunnel)
{
m_OutboundTunnels.push_back (newTunnel);
auto pool = newTunnel->GetTunnelPool ();
if (pool)
pool->TunnelCreated (newTunnel);
}
void Tunnels::AddInboundTunnel (InboundTunnel * newTunnel)