Browse Source

use any router for second hop of tunnel

pull/14/head
orignal 11 years ago
parent
commit
bd8ea0bac0
  1. 7
      NetDb.cpp
  2. 9
      Tunnel.cpp

7
NetDb.cpp

@ -499,12 +499,15 @@ namespace data @@ -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)

9
Tunnel.cpp

@ -395,16 +395,15 @@ namespace tunnel @@ -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…
Cancel
Save