Browse Source

don't sample too small list of eligible introducers

pull/2105/head
orignal 2 weeks ago
parent
commit
1a6109109a
  1. 7
      libi2pd/SSU2.cpp

7
libi2pd/SSU2.cpp

@ -1239,8 +1239,11 @@ namespace transport @@ -1239,8 +1239,11 @@ namespace transport
(!v4 && (s.second->GetRemoteTransports () & i2p::data::RouterInfo::eSSU2V6))))
eligible.push_back (s.second);
}
std::sample (eligible.begin(), eligible.end(), std::back_inserter(ret), maxNumIntroducers, m_Rng);
if (eligible.size () <= (size_t)maxNumIntroducers)
return eligible;
else
std::sample (eligible.begin(), eligible.end(), std::back_inserter(ret), maxNumIntroducers, m_Rng);
return ret;
}

Loading…
Cancel
Save