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

View File

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