void TunnelPool::CreateInboundTunnel () { auto outboundTunnel = GetNextOutboundTunnel (); if (!outboundTunnel) outboundTunnel = tunnels.GetNextOutboundTunnel (); LogPrint (eLogDebug, "Tunnels: Creating destination inbound tunnel..."); std::vector<std::shared_ptr<const i2p::data::IdentityEx> > peers; if (SelectPeers (peers, true)) { std::reverse (peers.begin (), peers.end ()); auto tunnel = tunnels.CreateTunnel<InboundTunnel> (std::make_shared<TunnelConfig> (peers), outboundTunnel); tunnel->SetTunnelPool (shared_from_this ()); } else LogPrint (eLogError, "Tunnels: Can't create inbound tunnel, no peers available"); }
void TunnelPool::CreateInboundTunnel() { auto outboundTunnel = GetNextOutboundTunnel(); if (!outboundTunnel) outboundTunnel = tunnels.GetNextOutboundTunnel(); LogPrint("Creating destination inbound tunnel..."); std::vector<std::shared_ptr<const i2p::data::RouterInfo> > hops; if (SelectPeers(hops, true)) { std::reverse(hops.begin(), hops.end()); auto tunnel = tunnels.CreateTunnel<InboundTunnel> ( std::make_shared<TunnelConfig> (hops), outboundTunnel); tunnel->SetTunnelPool(shared_from_this()); } else { LogPrint(eLogError, "Can't create inbound tunnel. No peers available"); } }
void TunnelPool::CreateOutboundTunnel () { auto inboundTunnel = GetNextInboundTunnel (); if (!inboundTunnel) inboundTunnel = tunnels.GetNextInboundTunnel (); if (inboundTunnel) { LogPrint (eLogDebug, "Tunnels: Creating destination outbound tunnel..."); std::vector<std::shared_ptr<const i2p::data::IdentityEx> > peers; if (SelectPeers (peers, false)) { auto tunnel = tunnels.CreateTunnel<OutboundTunnel> ( std::make_shared<TunnelConfig> (peers, inboundTunnel->GetNextTunnelID (), inboundTunnel->GetNextIdentHash ())); tunnel->SetTunnelPool (shared_from_this ()); } else LogPrint (eLogError, "Tunnels: Can't create outbound tunnel, no peers available"); } else LogPrint (eLogError, "Tunnels: Can't create outbound tunnel, no inbound tunnels found"); }
void TunnelPool::CreateOutboundTunnel() { auto inboundTunnel = GetNextInboundTunnel(); if (!inboundTunnel) inboundTunnel = tunnels.GetNextInboundTunnel(); if (inboundTunnel) { LogPrint("Creating destination outbound tunnel..."); std::vector<std::shared_ptr<const i2p::data::RouterInfo> > hops; if (SelectPeers(hops, false)) { auto tunnel = tunnels.CreateTunnel<OutboundTunnel> ( std::make_shared<TunnelConfig> ( hops, inboundTunnel->GetTunnelConfig())); tunnel->SetTunnelPool(shared_from_this()); } else { LogPrint(eLogError, "Can't create outbound tunnel. No peers available"); } } else { LogPrint(eLogError, "Can't create outbound tunnel. No inbound tunnels found"); } }