mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-30 20:24:15 +00:00
speedup inbound tunnels creation
This commit is contained in:
parent
13a88c4e92
commit
cf6fa2d41d
@ -169,14 +169,14 @@ namespace tunnel
|
|||||||
*m_OutboundTunnels.begin () : tunnels.GetNextOutboundTunnel ();
|
*m_OutboundTunnels.begin () : tunnels.GetNextOutboundTunnel ();
|
||||||
LogPrint ("Creating destination inbound tunnel...");
|
LogPrint ("Creating destination inbound tunnel...");
|
||||||
auto firstHop = i2p::data::netdb.GetRandomRouter (outboundTunnel ? outboundTunnel->GetEndpointRouter () : nullptr);
|
auto firstHop = i2p::data::netdb.GetRandomRouter (outboundTunnel ? outboundTunnel->GetEndpointRouter () : nullptr);
|
||||||
auto secondHop = i2p::data::netdb.GetRandomRouter (firstHop);
|
auto secondHop = outboundTunnel ? outboundTunnel->GetTunnelConfig ()->GetFirstHop ()->router : nullptr;
|
||||||
|
if (!secondHop || secondHop->GetIdentHash () == i2p::context.GetIdentHash ())
|
||||||
|
secondHop = i2p::data::netdb.GetRandomRouter (firstHop);
|
||||||
auto * tunnel = tunnels.CreateTunnel<InboundTunnel> (
|
auto * tunnel = tunnels.CreateTunnel<InboundTunnel> (
|
||||||
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
|
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
|
||||||
{
|
{
|
||||||
firstHop,
|
firstHop,
|
||||||
secondHop
|
secondHop
|
||||||
// TODO: switch to 3-hops later
|
|
||||||
/*i2p::data::netdb.GetRandomRouter (secondHop) */
|
|
||||||
}),
|
}),
|
||||||
outboundTunnel);
|
outboundTunnel);
|
||||||
tunnel->SetTunnelPool (this);
|
tunnel->SetTunnelPool (this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user