Browse Source

use rng from pool for lease selection

pull/2101/head
orignal 3 months ago
parent
commit
a837e5c502
  1. 3
      libi2pd_client/I2CP.cpp

3
libi2pd_client/I2CP.cpp

@ -226,7 +226,8 @@ namespace client
leases = remote->GetNonExpiredLeases (true); // with threshold leases = remote->GetNonExpiredLeases (true); // with threshold
if (!leases.empty ()) if (!leases.empty ())
{ {
remoteLease = leases[rand () % leases.size ()]; auto pool = GetTunnelPool ();
remoteLease = leases[(pool ? pool->GetRng ()() : rand ()) % leases.size ()];
auto leaseRouter = i2p::data::netdb.FindRouter (remoteLease->tunnelGateway); auto leaseRouter = i2p::data::netdb.FindRouter (remoteLease->tunnelGateway);
outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (nullptr, outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (nullptr,
leaseRouter ? leaseRouter->GetCompatibleTransports (false) : (i2p::data::RouterInfo::CompatibleTransports)i2p::data::RouterInfo::eAllTransports); leaseRouter ? leaseRouter->GetCompatibleTransports (false) : (i2p::data::RouterInfo::CompatibleTransports)i2p::data::RouterInfo::eAllTransports);

Loading…
Cancel
Save