set pool for zero-hops tunnels

This commit is contained in:
orignal 2021-07-30 14:12:50 -04:00
parent b16b753ed2
commit 1e01c30e63
2 changed files with 10 additions and 8 deletions

View File

@ -763,8 +763,8 @@ namespace tunnel
if (m_InboundTunnels.empty ())
{
LogPrint (eLogDebug, "Tunnel: Creating zero hops inbound tunnel");
CreateZeroHopsInboundTunnel ();
CreateZeroHopsOutboundTunnel ();
CreateZeroHopsInboundTunnel (nullptr);
CreateZeroHopsOutboundTunnel (nullptr);
if (!m_ExploratoryPool)
{
int ibLen; i2p::config::GetOption("exploratory.inbound.length", ibLen);
@ -854,7 +854,7 @@ namespace tunnel
if (config)
return CreateTunnel<InboundTunnel>(config, pool, outboundTunnel);
else
return CreateZeroHopsInboundTunnel ();
return CreateZeroHopsInboundTunnel (pool);
}
std::shared_ptr<OutboundTunnel> Tunnels::CreateOutboundTunnel (std::shared_ptr<TunnelConfig> config, std::shared_ptr<TunnelPool> pool)
@ -862,7 +862,7 @@ namespace tunnel
if (config)
return CreateTunnel<OutboundTunnel>(config, pool);
else
return CreateZeroHopsOutboundTunnel ();
return CreateZeroHopsOutboundTunnel (pool);
}
void Tunnels::AddPendingTunnel (uint32_t replyMsgID, std::shared_ptr<InboundTunnel> tunnel)
@ -912,18 +912,20 @@ namespace tunnel
}
std::shared_ptr<ZeroHopsInboundTunnel> Tunnels::CreateZeroHopsInboundTunnel ()
std::shared_ptr<ZeroHopsInboundTunnel> Tunnels::CreateZeroHopsInboundTunnel (std::shared_ptr<TunnelPool> pool)
{
auto inboundTunnel = std::make_shared<ZeroHopsInboundTunnel> ();
inboundTunnel->SetTunnelPool (pool);
inboundTunnel->SetState (eTunnelStateEstablished);
m_InboundTunnels.push_back (inboundTunnel);
m_Tunnels[inboundTunnel->GetTunnelID ()] = inboundTunnel;
return inboundTunnel;
}
std::shared_ptr<ZeroHopsOutboundTunnel> Tunnels::CreateZeroHopsOutboundTunnel ()
std::shared_ptr<ZeroHopsOutboundTunnel> Tunnels::CreateZeroHopsOutboundTunnel (std::shared_ptr<TunnelPool> pool)
{
auto outboundTunnel = std::make_shared<ZeroHopsOutboundTunnel> ();
outboundTunnel->SetTunnelPool (pool);
outboundTunnel->SetState (eTunnelStateEstablished);
m_OutboundTunnels.push_back (outboundTunnel);
// we don't insert into m_Tunnels

View File

@ -237,8 +237,8 @@ namespace tunnel
void ManagePendingTunnels (PendingTunnels& pendingTunnels);
void ManageTunnelPools (uint64_t ts);
std::shared_ptr<ZeroHopsInboundTunnel> CreateZeroHopsInboundTunnel ();
std::shared_ptr<ZeroHopsOutboundTunnel> CreateZeroHopsOutboundTunnel ();
std::shared_ptr<ZeroHopsInboundTunnel> CreateZeroHopsInboundTunnel (std::shared_ptr<TunnelPool> pool);
std::shared_ptr<ZeroHopsOutboundTunnel> CreateZeroHopsOutboundTunnel (std::shared_ptr<TunnelPool> pool);
private: