Browse Source

done insert NTCP2 ipv6 address twice

pull/1234/head
orignal 6 years ago
parent
commit
b67424643d
  1. 7
      libi2pd/RouterContext.cpp

7
libi2pd/RouterContext.cpp

@ -455,7 +455,7 @@ namespace i2p
void RouterContext::UpdateNTCP2V6Address (const boost::asio::ip::address& host) void RouterContext::UpdateNTCP2V6Address (const boost::asio::ip::address& host)
{ {
bool updated = false; bool updated = false, found = false;
int port = 0; int port = 0;
auto& addresses = m_RouterInfo.GetAddresses (); auto& addresses = m_RouterInfo.GetAddresses ();
for (auto& addr: addresses) for (auto& addr: addresses)
@ -468,15 +468,16 @@ namespace i2p
{ {
addr->host = host; addr->host = host;
updated = true; updated = true;
break;
} }
found = true;
break;
} }
else else
port = addr->port; // NTCP2 v4 port = addr->port; // NTCP2 v4
} }
} }
if (!updated && port) // we have found NTCP2 v4 but not v6 if (!found && port) // we have found NTCP2 v4 but not v6
{ {
m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port); m_RouterInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv, host, port);
updated = true; updated = true;

Loading…
Cancel
Save