don't cleanup ipv6 introducers list twice

This commit is contained in:
orignal 2021-04-25 17:55:13 -04:00
parent 4a0dbec4fb
commit e091eba831

View File

@ -726,6 +726,8 @@ namespace transport
m_Introducers.clear (); m_Introducers.clear ();
return; return;
} }
// we are firewalled
if (!i2p::context.IsUnreachable ()) i2p::context.SetUnreachable (true, false); // v4
} }
else else
{ {
@ -741,12 +743,16 @@ namespace transport
m_IntroducersV6.clear (); m_IntroducersV6.clear ();
return; return;
} }
}
// we are firewalled // we are firewalled
if (!i2p::context.IsUnreachable () || !v4) i2p::context.SetUnreachable (v4, !v4); auto addr = i2p::context.GetRouterInfo ().GetSSUV6Address ();
if (addr && addr->ssu && addr->ssu->introducers.empty ())
i2p::context.SetUnreachable (false, true); // v6
}
std::list<boost::asio::ip::udp::endpoint> newList; std::list<boost::asio::ip::udp::endpoint> newList;
size_t numIntroducers = 0; size_t numIntroducers = 0;
uint32_t ts = i2p::util::GetSecondsSinceEpoch (); uint32_t ts = i2p::util::GetSecondsSinceEpoch ();
std::set<i2p::data::IdentHash> excluded;
auto& introducers = v4 ? m_Introducers : m_IntroducersV6; auto& introducers = v4 ? m_Introducers : m_IntroducersV6;
for (const auto& it : introducers) for (const auto& it : introducers)
{ {
@ -759,6 +765,8 @@ namespace transport
{ {
newList.push_back (it); newList.push_back (it);
numIntroducers++; numIntroducers++;
if (session->GetRemoteIdentity ())
excluded.insert (session->GetRemoteIdentity ()->GetIdentHash ());
} }
else else
session = nullptr; session = nullptr;
@ -766,8 +774,6 @@ namespace transport
if (!session) if (!session)
i2p::context.RemoveIntroducer (it); i2p::context.RemoveIntroducer (it);
} }
std::set<i2p::data::IdentHash> excluded;
if (numIntroducers < SSU_MAX_NUM_INTRODUCERS) if (numIntroducers < SSU_MAX_NUM_INTRODUCERS)
{ {
// create new // create new