Browse Source

update our IP adress from SSU2

pull/1774/head
orignal 3 years ago
parent
commit
6143515ac6
  1. 6
      libi2pd/SSU2Session.cpp

6
libi2pd/SSU2Session.cpp

@ -719,13 +719,13 @@ namespace transport
return false; return false;
} }
SetRemoteIdentity (ri->GetRouterIdentity ()); SetRemoteIdentity (ri->GetRouterIdentity ());
m_Server.AddSessionByRouterHash (shared_from_this ()); // we know remote router now
m_Address = ri->GetSSU2AddressWithStaticKey (S, m_RemoteEndpoint.address ().is_v6 ()); m_Address = ri->GetSSU2AddressWithStaticKey (S, m_RemoteEndpoint.address ().is_v6 ());
if (!m_Address) if (!m_Address)
{ {
LogPrint (eLogError, "SSU2: No SSU2 address with static key found in SessionConfirmed"); LogPrint (eLogError, "SSU2: No SSU2 address with static key found in SessionConfirmed");
return false; return false;
} }
m_Server.AddSessionByRouterHash (shared_from_this ()); // we know remote router now
m_RemoteTransports = ri->GetCompatibleTransports (false); m_RemoteTransports = ri->GetCompatibleTransports (false);
i2p::data::netdb.PostI2NPMsg (CreateDatabaseStoreMsg (ri)); // TODO: should insert ri i2p::data::netdb.PostI2NPMsg (CreateDatabaseStoreMsg (ri)); // TODO: should insert ri
// handle other blocks // handle other blocks
@ -1177,7 +1177,11 @@ namespace transport
{ {
boost::asio::ip::udp::endpoint ep; boost::asio::ip::udp::endpoint ep;
if (ExtractEndpoint (buf + offset, size, ep)) if (ExtractEndpoint (buf + offset, size, ep))
{
LogPrint (eLogInfo, "SSU2: Our external address is ", ep); LogPrint (eLogInfo, "SSU2: Our external address is ", ep);
if (!i2p::util::net::IsInReservedRange (ep.address ()))
i2p::context.UpdateAddress (ep.address ());
}
break; break;
} }
case eSSU2BlkIntroKey: case eSSU2BlkIntroKey:

Loading…
Cancel
Save