From 75611866ebe33a924814f6526a5b821334b1098c Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 14 Aug 2022 10:43:16 -0400 Subject: [PATCH] update router's transports when SSU or NTCP address was deleted --- libi2pd/RouterContext.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index a663cf92..77d3763d 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -633,6 +633,7 @@ namespace i2p void RouterContext::RemoveNTCPAddress (bool v4only) { + bool updated = false; auto& addresses = m_RouterInfo.GetAddresses (); for (auto it = addresses.begin (); it != addresses.end ();) { @@ -640,23 +641,32 @@ namespace i2p (!v4only || (*it)->host.is_v4 ())) { it = addresses.erase (it); + updated = true; if (v4only) break; // otherwise might be more than one address } else ++it; } + if (updated) + m_RouterInfo.UpdateSupportedTransports (); } void RouterContext::RemoveSSUAddress () { + bool updated = false; auto& addresses = m_RouterInfo.GetAddresses (); for (auto it = addresses.begin (); it != addresses.end ();) { if ((*it)->transportStyle == i2p::data::RouterInfo::eTransportSSU) + { it = addresses.erase (it); + updated = true; + } else ++it; } + if (updated) + m_RouterInfo.UpdateSupportedTransports (); } void RouterContext::SetUnreachableSSU2 (bool v4, bool v6)