From 796701d37003379675cb2487d72ddee2b7a74658 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 11 Dec 2025 18:46:06 -0500 Subject: [PATCH] use destination's RNG to select next tunnel --- libi2pd/TunnelPool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libi2pd/TunnelPool.cpp b/libi2pd/TunnelPool.cpp index 80e07b79..15d79ce0 100644 --- a/libi2pd/TunnelPool.cpp +++ b/libi2pd/TunnelPool.cpp @@ -228,7 +228,7 @@ namespace tunnel typename TTunnels::value_type excluded, i2p::data::RouterInfo::CompatibleTransports compatible) { if (tunnels.empty ()) return nullptr; - uint32_t ind = i2p::tunnel::tunnels.GetRng ()() % (tunnels.size ()/2 + 1), i = 0; + uint32_t ind = (m_LocalDestination ? m_LocalDestination->GetRng ()() : rand ()) % (tunnels.size ()/2 + 1), i = 0; bool skipped = false; typename TTunnels::value_type tunnel = nullptr; for (const auto& it: tunnels) @@ -248,7 +248,7 @@ namespace tunnel } if (!tunnel && skipped) { - ind = i2p::tunnel::tunnels.GetRng ()() % (tunnels.size ()/2 + 1), i = 0; + ind = (m_LocalDestination ? m_LocalDestination->GetRng ()() : rand ()) % (tunnels.size ()/2 + 1), i = 0; for (const auto& it: tunnels) { if (it->IsEstablished () && it != excluded)