diff --git a/NetDb.cpp b/NetDb.cpp index a00e900d..05d9d9fa 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -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) diff --git a/Tunnel.cpp b/Tunnel.cpp index f92337f7..fe904369 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -395,16 +395,15 @@ namespace tunnel } else { - //OutboundTunnel * outboundTunnel = GetNextOutboundTunnel (); + LogPrint ("Creating two hops outbound tunnel..."); CreateTunnel ( new TunnelConfig (std::vector { - 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 ())); } } }