mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
request multiple introducers at the time
This commit is contained in:
parent
618aa26454
commit
def9873a70
|
@ -1169,7 +1169,7 @@ namespace data
|
|||
return GetRandomRouter (
|
||||
[](std::shared_ptr<const RouterInfo> router)->bool
|
||||
{
|
||||
return !router->IsHidden () && router->IsIntroducer ();
|
||||
return router->IsIntroducer () && !router->IsHidden () && !router->IsFloodfill (); // floodfills don't send relay tag
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -671,7 +671,7 @@ namespace transport
|
|||
ScheduleIntroducersUpdateTimer ();
|
||||
return;
|
||||
}
|
||||
if (i2p::context.GetStatus () == eRouterStatusOK) return; // we don't need introducers anymore
|
||||
if (i2p::context.GetStatus () != eRouterStatusFirewalled) return; // we don't need introducers
|
||||
// we are firewalled
|
||||
if (!i2p::context.IsUnreachable ()) i2p::context.SetUnreachable ();
|
||||
std::list<boost::asio::ip::udp::endpoint> newList;
|
||||
|
@ -712,9 +712,19 @@ namespace transport
|
|||
m_Introducers = newList;
|
||||
if (m_Introducers.size () < SSU_MAX_NUM_INTRODUCERS)
|
||||
{
|
||||
auto introducer = i2p::data::netdb.GetRandomIntroducer ();
|
||||
if (introducer)
|
||||
CreateSession (introducer);
|
||||
for (auto i = m_Introducers.size (); i < SSU_MAX_NUM_INTRODUCERS; i++)
|
||||
{
|
||||
auto introducer = i2p::data::netdb.GetRandomIntroducer ();
|
||||
if (introducer)
|
||||
{
|
||||
auto address = introducer->GetSSUAddress (true); // v4
|
||||
if (address && !address->host.is_unspecified ())
|
||||
{
|
||||
boost::asio::ip::udp::endpoint ep (address->host, address->port);
|
||||
CreateDirectSession (introducer, ep, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ScheduleIntroducersUpdateTimer ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue