From e091eba83107e22d8a656c7fe28bc9a030f7f467 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 25 Apr 2021 17:55:13 -0400 Subject: [PATCH] don't cleanup ipv6 introducers list twice --- libi2pd/SSU.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libi2pd/SSU.cpp b/libi2pd/SSU.cpp index 38e0196b..11fab97f 100644 --- a/libi2pd/SSU.cpp +++ b/libi2pd/SSU.cpp @@ -726,6 +726,8 @@ namespace transport m_Introducers.clear (); return; } + // we are firewalled + if (!i2p::context.IsUnreachable ()) i2p::context.SetUnreachable (true, false); // v4 } else { @@ -740,13 +742,17 @@ namespace transport // we don't need introducers m_IntroducersV6.clear (); return; - } + } + // we are firewalled + auto addr = i2p::context.GetRouterInfo ().GetSSUV6Address (); + if (addr && addr->ssu && addr->ssu->introducers.empty ()) + i2p::context.SetUnreachable (false, true); // v6 } - // we are firewalled - if (!i2p::context.IsUnreachable () || !v4) i2p::context.SetUnreachable (v4, !v4); + std::list newList; size_t numIntroducers = 0; uint32_t ts = i2p::util::GetSecondsSinceEpoch (); + std::set excluded; auto& introducers = v4 ? m_Introducers : m_IntroducersV6; for (const auto& it : introducers) { @@ -759,6 +765,8 @@ namespace transport { newList.push_back (it); numIntroducers++; + if (session->GetRemoteIdentity ()) + excluded.insert (session->GetRemoteIdentity ()->GetIdentHash ()); } else session = nullptr; @@ -766,8 +774,6 @@ namespace transport if (!session) i2p::context.RemoveIntroducer (it); } - - std::set excluded; if (numIntroducers < SSU_MAX_NUM_INTRODUCERS) { // create new