Skip to content

Commit

Permalink
don't publish introducers with zero iTag
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Aug 5, 2023
1 parent e170c39 commit 38795a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libi2pd/SSU2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ namespace transport
if (it1 != m_SessionsByRouterHash.end ())
{
auto session = it1->second;
if (session->IsEstablished ())
if (session->IsEstablished () && session->GetRelayTag () && session->IsOutgoing ())
{
session->SetCreationTime (session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION);
if (std::find (newList.begin (), newList.end (), it) == newList.end ())
Expand All @@ -1040,11 +1040,12 @@ namespace transport

for (const auto& it : sessions)
{
uint32_t tag = it->GetRelayTag ();
uint32_t exp = it->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION;
if (ts + SSU2_TO_INTRODUCER_SESSION_DURATION/2 > exp)
if (!tag || ts + SSU2_TO_INTRODUCER_SESSION_DURATION/2 > exp)
continue; // don't pick too old session for introducer
i2p::data::RouterInfo::Introducer introducer;
introducer.iTag = it->GetRelayTag ();
introducer.iTag = tag;
introducer.iH = it->GetRemoteIdentity ()->GetIdentHash ();
introducer.iExp = exp;
excluded.insert (it->GetRemoteIdentity ()->GetIdentHash ());
Expand Down

0 comments on commit 38795a4

Please sign in to comment.