Browse Source

keep non-published, but not-expired introducers in the introducers list

pull/1957/head
orignal 1 year ago
parent
commit
d6834d6a9a
  1. 15
      libi2pd/SSU2.cpp

15
libi2pd/SSU2.cpp

@ -983,7 +983,7 @@ namespace transport @@ -983,7 +983,7 @@ namespace transport
void SSU2Server::UpdateIntroducers (bool v4)
{
uint32_t ts = i2p::util::GetSecondsSinceEpoch ();
std::list<i2p::data::IdentHash> newList;
std::list<i2p::data::IdentHash> newList, impliedList;
auto& introducers = v4 ? m_Introducers : m_IntroducersV6;
std::set<i2p::data::IdentHash> excluded;
for (const auto& it : introducers)
@ -997,13 +997,18 @@ namespace transport @@ -997,13 +997,18 @@ namespace transport
}
if (session && session->IsEstablished ())
{
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION)
session->SendKeepAlive ();
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION)
newList.push_back (it);
else
{
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION)
{
impliedList.push_back (it); // keep in introducers list, but not publish
session->SendKeepAlive ();
}
session = nullptr;
}
}
if (!session)
i2p::context.RemoveSSU2Introducer (it, v4);
}
@ -1024,14 +1029,11 @@ namespace transport @@ -1024,14 +1029,11 @@ namespace transport
{
session->SetCreationTime (session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION);
if (std::find (newList.begin (), newList.end (), it) == newList.end ())
{
newList.push_back (it);
sessions.push_back (session);
}
}
}
}
}
for (const auto& it : sessions)
{
@ -1075,6 +1077,7 @@ namespace transport @@ -1075,6 +1077,7 @@ namespace transport
}
}
}
introducers.splice (introducers.end (), impliedList); // insert non-published, but non-expired introducers back
}
void SSU2Server::ScheduleIntroducersUpdateTimer ()

Loading…
Cancel
Save