mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00:00
pick random introducer
This commit is contained in:
parent
2cc9791bf2
commit
ff89edf127
@ -513,9 +513,10 @@ namespace transport
|
|||||||
std::shared_ptr<SSUSession> introducerSession;
|
std::shared_ptr<SSUSession> introducerSession;
|
||||||
const i2p::data::RouterInfo::Introducer * introducer = nullptr;
|
const i2p::data::RouterInfo::Introducer * introducer = nullptr;
|
||||||
// we might have a session to introducer already
|
// we might have a session to introducer already
|
||||||
|
auto offset = rand ();
|
||||||
for (int i = 0; i < numIntroducers; i++)
|
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->iPort) continue; // skip invalid introducer
|
||||||
if (intr->iExp > 0 && ts > intr->iExp) continue; // skip expired introducer
|
if (intr->iExp > 0 && ts > intr->iExp) continue; // skip expired introducer
|
||||||
boost::asio::ip::udp::endpoint ep (intr->iHost, intr->iPort);
|
boost::asio::ip::udp::endpoint ep (intr->iHost, intr->iPort);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user