mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-19 01:09:58 +00: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)
|
void SSU2Server::UpdateIntroducers (bool v4)
|
||||||
{
|
{
|
||||||
uint32_t ts = i2p::util::GetSecondsSinceEpoch ();
|
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;
|
auto& introducers = v4 ? m_Introducers : m_IntroducersV6;
|
||||||
std::set<i2p::data::IdentHash> excluded;
|
std::set<i2p::data::IdentHash> excluded;
|
||||||
for (const auto& it : introducers)
|
for (const auto& it : introducers)
|
||||||
@ -997,12 +997,17 @@ namespace transport
|
|||||||
}
|
}
|
||||||
if (session && session->IsEstablished ())
|
if (session && session->IsEstablished ())
|
||||||
{
|
{
|
||||||
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION)
|
|
||||||
session->SendKeepAlive ();
|
|
||||||
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION)
|
if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION)
|
||||||
newList.push_back (it);
|
newList.push_back (it);
|
||||||
else
|
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;
|
session = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!session)
|
if (!session)
|
||||||
i2p::context.RemoveSSU2Introducer (it, v4);
|
i2p::context.RemoveSSU2Introducer (it, v4);
|
||||||
@ -1024,10 +1029,7 @@ namespace transport
|
|||||||
{
|
{
|
||||||
session->SetCreationTime (session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION);
|
session->SetCreationTime (session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION);
|
||||||
if (std::find (newList.begin (), newList.end (), it) == newList.end ())
|
if (std::find (newList.begin (), newList.end (), it) == newList.end ())
|
||||||
{
|
|
||||||
newList.push_back (it);
|
|
||||||
sessions.push_back (session);
|
sessions.push_back (session);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,6 +1077,7 @@ namespace transport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
introducers.splice (introducers.end (), impliedList); // insert non-published, but non-expired introducers back
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Server::ScheduleIntroducersUpdateTimer ()
|
void SSU2Server::ScheduleIntroducersUpdateTimer ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user