mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
use any router for second hop of tunnel
This commit is contained in:
parent
9e91be671d
commit
bd8ea0bac0
|
@ -499,12 +499,15 @@ namespace data
|
|||
{
|
||||
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator ();
|
||||
uint32_t ind = rnd.GenerateWord32 (0, m_RouterInfos.size () - 1), i = 0;
|
||||
RouterInfo * last = nullptr;
|
||||
for (auto it: m_RouterInfos)
|
||||
{
|
||||
if (i >= ind) return it.second;
|
||||
if (!it.second->IsUnreachable ())
|
||||
last = it.second;
|
||||
if (i >= ind) break;
|
||||
else i++;
|
||||
}
|
||||
return nullptr;
|
||||
return last;
|
||||
}
|
||||
|
||||
void NetDb::PostI2NPMsg (I2NPMessage * msg)
|
||||
|
|
|
@ -395,16 +395,15 @@ namespace tunnel
|
|||
}
|
||||
else
|
||||
{
|
||||
//OutboundTunnel * outboundTunnel = GetNextOutboundTunnel ();
|
||||
|
||||
LogPrint ("Creating two hops outbound tunnel...");
|
||||
CreateTunnel<OutboundTunnel> (
|
||||
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
|
||||
{
|
||||
i2p::data::netdb.GetRandomNTCPRouter (),
|
||||
i2p::data::netdb.GetRandomNTCPRouter ()
|
||||
i2p::data::netdb.GetRandomNTCPRouter (), // first hop must be NTCP
|
||||
i2p::data::netdb.GetRandomRouter ()
|
||||
},
|
||||
inboundTunnel->GetTunnelConfig ())/*,
|
||||
outboundTunnel*/);
|
||||
inboundTunnel->GetTunnelConfig ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue