Browse Source

request multiple introducers at the time

pull/1640/head
orignal 4 years ago
parent
commit
def9873a70
  1. 2
      libi2pd/NetDb.cpp
  2. 18
      libi2pd/SSU.cpp

2
libi2pd/NetDb.cpp

@ -1169,7 +1169,7 @@ namespace data @@ -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
});
}

18
libi2pd/SSU.cpp

@ -671,7 +671,7 @@ namespace transport @@ -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 @@ -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…
Cancel
Save