mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
add/remove SSU2 introducers to local RouterInfo
This commit is contained in:
parent
cf0d3b5f61
commit
2197cd8620
5 changed files with 70 additions and 4 deletions
|
@ -770,8 +770,11 @@ namespace transport
|
|||
newList.push_back (it);
|
||||
excluded.insert (it->GetRemoteIdentity ()->GetIdentHash ());
|
||||
}
|
||||
// TODO: remove introducer
|
||||
else
|
||||
i2p::context.RemoveSSU2Introducer (it->GetRemoteIdentity ()->GetIdentHash (), it->GetAddress ()->IsV4 ());
|
||||
}
|
||||
else
|
||||
i2p::context.RemoveSSU2Introducer (it->GetRemoteIdentity ()->GetIdentHash (), it->GetAddress ()->IsV4 ());
|
||||
}
|
||||
if (newList.size () < SSU2_MAX_NUM_INTRODUCERS)
|
||||
{
|
||||
|
@ -789,9 +792,16 @@ namespace transport
|
|||
|
||||
for (const auto& it : sessions)
|
||||
{
|
||||
// TODO: add introducer
|
||||
newList.push_back (it);
|
||||
if (newList.size () >= SSU2_MAX_NUM_INTRODUCERS) break;
|
||||
i2p::data::RouterInfo::Introducer introducer;
|
||||
introducer.iTag = it->GetRelayTag ();
|
||||
introducer.iKey = it->GetRemoteIdentity ()->GetIdentHash ();
|
||||
introducer.iExp = it->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION;
|
||||
excluded.insert (it->GetRemoteIdentity ()->GetIdentHash ());
|
||||
if (i2p::context.AddSSU2Introducer (introducer, it->GetAddress ()->IsV4 ()))
|
||||
{
|
||||
newList.push_back (it);
|
||||
if (newList.size () >= SSU2_MAX_NUM_INTRODUCERS) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
introducers = newList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue