use Rng from pool if possible

This commit is contained in:
orignal 2024-08-31 08:02:56 -04:00
parent 8cf9cc1a01
commit 509c039e2f
3 changed files with 15 additions and 5 deletions

View file

@ -422,7 +422,7 @@ namespace datagram
{
auto pool = m_LocalDestination->GetTunnelPool ();
if (pool)
idx = m_LocalDestination->GetTunnelPool ()->GetRng ()() % sz;
idx = pool->GetRng ()() % sz;
}
if (idx < 0) idx = rand () % sz;
path->remoteLease = ls[idx];
@ -455,7 +455,7 @@ namespace datagram
{
auto pool = m_LocalDestination->GetTunnelPool ();
if (pool)
idx = m_LocalDestination->GetTunnelPool ()->GetRng ()() % sz;
idx = pool->GetRng ()() % sz;
}
if (idx < 0) idx = rand () % sz;
path->remoteLease = ls[idx];