mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
use pool's rng for random tunnel/remote lease selection
This commit is contained in:
parent
0992a5124f
commit
a69eade1f4
@ -417,7 +417,14 @@ namespace datagram
|
||||
auto sz = ls.size();
|
||||
if (sz)
|
||||
{
|
||||
auto idx = rand() % sz;
|
||||
int idx = -1;
|
||||
if (m_LocalDestination)
|
||||
{
|
||||
auto pool = m_LocalDestination->GetTunnelPool ();
|
||||
if (pool)
|
||||
idx = m_LocalDestination->GetTunnelPool ()->GetRng ()() % sz;
|
||||
}
|
||||
if (idx < 0) idx = rand () % sz;
|
||||
path->remoteLease = ls[idx];
|
||||
}
|
||||
else
|
||||
@ -443,7 +450,14 @@ namespace datagram
|
||||
auto sz = ls.size();
|
||||
if (sz)
|
||||
{
|
||||
auto idx = rand() % sz;
|
||||
int idx = -1;
|
||||
if (m_LocalDestination)
|
||||
{
|
||||
auto pool = m_LocalDestination->GetTunnelPool ();
|
||||
if (pool)
|
||||
idx = m_LocalDestination->GetTunnelPool ()->GetRng ()() % sz;
|
||||
}
|
||||
if (idx < 0) idx = rand () % sz;
|
||||
path->remoteLease = ls[idx];
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user