mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
keep non-published, but not-expired introducers in the introducers list
This commit is contained in:
parent
413e25f20e
commit
d6834d6a9a
|
@ -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
|
|||
}
|
||||
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
|
|||
{
|
||||
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
|
|||
}
|
||||
}
|
||||
}
|
||||
introducers.splice (introducers.end (), impliedList); // insert non-published, but non-expired introducers back
|
||||
}
|
||||
|
||||
void SSU2Server::ScheduleIntroducersUpdateTimer ()
|
||||
|
|
Loading…
Reference in a new issue