mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
update router's transports when SSU or NTCP address was deleted
This commit is contained in:
parent
c3dd7ed73a
commit
75611866eb
1 changed files with 10 additions and 0 deletions
|
@ -633,6 +633,7 @@ namespace i2p
|
||||||
|
|
||||||
void RouterContext::RemoveNTCPAddress (bool v4only)
|
void RouterContext::RemoveNTCPAddress (bool v4only)
|
||||||
{
|
{
|
||||||
|
bool updated = false;
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto it = addresses.begin (); it != addresses.end ();)
|
for (auto it = addresses.begin (); it != addresses.end ();)
|
||||||
{
|
{
|
||||||
|
@ -640,23 +641,32 @@ namespace i2p
|
||||||
(!v4only || (*it)->host.is_v4 ()))
|
(!v4only || (*it)->host.is_v4 ()))
|
||||||
{
|
{
|
||||||
it = addresses.erase (it);
|
it = addresses.erase (it);
|
||||||
|
updated = true;
|
||||||
if (v4only) break; // otherwise might be more than one address
|
if (v4only) break; // otherwise might be more than one address
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
if (updated)
|
||||||
|
m_RouterInfo.UpdateSupportedTransports ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterContext::RemoveSSUAddress ()
|
void RouterContext::RemoveSSUAddress ()
|
||||||
{
|
{
|
||||||
|
bool updated = false;
|
||||||
auto& addresses = m_RouterInfo.GetAddresses ();
|
auto& addresses = m_RouterInfo.GetAddresses ();
|
||||||
for (auto it = addresses.begin (); it != addresses.end ();)
|
for (auto it = addresses.begin (); it != addresses.end ();)
|
||||||
{
|
{
|
||||||
if ((*it)->transportStyle == i2p::data::RouterInfo::eTransportSSU)
|
if ((*it)->transportStyle == i2p::data::RouterInfo::eTransportSSU)
|
||||||
|
{
|
||||||
it = addresses.erase (it);
|
it = addresses.erase (it);
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
if (updated)
|
||||||
|
m_RouterInfo.UpdateSupportedTransports ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)
|
void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)
|
||||||
|
|
Loading…
Add table
Reference in a new issue