Browse Source

pick random introducer

pull/1656/head
orignal 4 years ago
parent
commit
ff89edf127
  1. 3
      libi2pd/SSU.cpp

3
libi2pd/SSU.cpp

@ -513,9 +513,10 @@ namespace transport @@ -513,9 +513,10 @@ namespace transport
std::shared_ptr<SSUSession> introducerSession;
const i2p::data::RouterInfo::Introducer * introducer = nullptr;
// we might have a session to introducer already
auto offset = rand ();
for (int i = 0; i < numIntroducers; i++)
{
auto intr = &(address->ssu->introducers[i]);
auto intr = &(address->ssu->introducers[(offset + i)%numIntroducers]);
if (!intr->iPort) continue; // skip invalid introducer
if (intr->iExp > 0 && ts > intr->iExp) continue; // skip expired introducer
boost::asio::ip::udp::endpoint ep (intr->iHost, intr->iPort);

Loading…
Cancel
Save