remove SSU address if SSU is off

This commit is contained in:
orignal 2022-08-09 19:12:11 -04:00
parent df92a85159
commit 3dd78a2589
3 changed files with 14 additions and 0 deletions

View File

@ -253,6 +253,7 @@ namespace util
if (!ipv4 && !ipv6)
i2p::context.SetStatus (eRouterStatusMesh);
}
if (!ssu) i2p::context.RemoveSSUAddress (); // TODO: remove later
bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
if (ssu2)
{

View File

@ -628,6 +628,18 @@ namespace i2p
}
}
void RouterContext::RemoveSSUAddress ()
{
auto& addresses = m_RouterInfo.GetAddresses ();
for (auto it = addresses.begin (); it != addresses.end ();)
{
if ((*it)->transportStyle == i2p::data::RouterInfo::eTransportSSU)
it = addresses.erase (it);
else
++it;
}
}
void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)
{
if (IsSSU2Only ())

View File

@ -123,6 +123,7 @@ namespace garlic
void PublishSSU2Address (int port, bool publish, bool v4, bool v6);
void UpdateSSU2Address (bool enable);
void RemoveNTCPAddress (bool v4only = true); // delete NTCP address for older routers. TODO: remove later
void RemoveSSUAddress (); // delete SSU address for older routers
bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer);
void RemoveIntroducer (const boost::asio::ip::udp::endpoint& e);
bool AddSSU2Introducer (const i2p::data::RouterInfo::Introducer& introducer, bool v4);