Browse Source

don't insert Yggdrasil address twice

pull/1634/head
orignal 4 years ago
parent
commit
fef4f13b8f
  1. 11
      libi2pd/RouterContext.cpp

11
libi2pd/RouterContext.cpp

@ -529,15 +529,18 @@ namespace i2p
uint16_t port = 0; uint16_t port = 0;
i2p::config::GetOption ("ntcp2.port", port); i2p::config::GetOption ("ntcp2.port", port);
if (!port) i2p::config::GetOption("port", port); if (!port) i2p::config::GetOption("port", port);
if (!port) bool foundMesh = false;
{
auto& addresses = m_RouterInfo.GetAddresses (); auto& addresses = m_RouterInfo.GetAddresses ();
for (auto& addr: addresses) for (auto& addr: addresses)
{ {
port = addr->port; if (!port) port = addr->port;
if (port) break; if (i2p::util::net::IsYggdrasilAddress (addr->host))
{
foundMesh = true;
break;
} }
} }
if (!foundMesh)
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port); m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port);
} }
else else

Loading…
Cancel
Save