|
|
@ -265,6 +265,7 @@ namespace transport |
|
|
|
m_OnEstablished = nullptr; |
|
|
|
m_OnEstablished = nullptr; |
|
|
|
if (m_RelayTag) |
|
|
|
if (m_RelayTag) |
|
|
|
m_Server.RemoveRelay (m_RelayTag); |
|
|
|
m_Server.RemoveRelay (m_RelayTag); |
|
|
|
|
|
|
|
m_Server.AddConnectedRecently (m_RemoteEndpoint, GetLastActivityTimestamp ()); |
|
|
|
m_SentHandshakePacket.reset (nullptr); |
|
|
|
m_SentHandshakePacket.reset (nullptr); |
|
|
|
m_SessionConfirmedFragment.reset (nullptr); |
|
|
|
m_SessionConfirmedFragment.reset (nullptr); |
|
|
|
m_PathChallenge.reset (nullptr); |
|
|
|
m_PathChallenge.reset (nullptr); |
|
|
@ -281,16 +282,12 @@ namespace transport |
|
|
|
transports.PeerDisconnected (shared_from_this ()); |
|
|
|
transports.PeerDisconnected (shared_from_this ()); |
|
|
|
auto remoteIdentity = GetRemoteIdentity (); |
|
|
|
auto remoteIdentity = GetRemoteIdentity (); |
|
|
|
if (remoteIdentity) |
|
|
|
if (remoteIdentity) |
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (), |
|
|
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (), |
|
|
|
" (", i2p::data::GetIdentHashAbbreviation (remoteIdentity->GetIdentHash ()), ") terminated"); |
|
|
|
" (", i2p::data::GetIdentHashAbbreviation (remoteIdentity->GetIdentHash ()), ") terminated"); |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (), " terminated"); |
|
|
|
LogPrint (eLogDebug, "SSU2: Session with ", GetRemoteEndpoint (), " terminated"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SSU2Session::RequestTermination (SSU2TerminationReason reason) |
|
|
|
void SSU2Session::RequestTermination (SSU2TerminationReason reason) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1153,7 +1150,7 @@ namespace transport |
|
|
|
if (profile) // older router?
|
|
|
|
if (profile) // older router?
|
|
|
|
profile->Duplicated (); // mark router as duplicated in profile
|
|
|
|
profile->Duplicated (); // mark router as duplicated in profile
|
|
|
|
else |
|
|
|
else |
|
|
|
LogPrint (eLogError, "SSU2: Host mismatch between published address ", m_Address->host, |
|
|
|
LogPrint (eLogInfo, "SSU2: Host mismatch between published address ", m_Address->host, |
|
|
|
" and actual endpoint ", m_RemoteEndpoint.address (), " from ", i2p::data::GetIdentHashAbbreviation (ri->GetIdentHash ())); |
|
|
|
" and actual endpoint ", m_RemoteEndpoint.address (), " from ", i2p::data::GetIdentHashAbbreviation (ri->GetIdentHash ())); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -2275,6 +2272,8 @@ namespace transport |
|
|
|
addr = r->GetSSU2Address (ep.address ().is_v4 ()); |
|
|
|
addr = r->GetSSU2Address (ep.address ().is_v4 ()); |
|
|
|
if (addr && m_Server.IsSupported (ep.address ()) && |
|
|
|
if (addr && m_Server.IsSupported (ep.address ()) && |
|
|
|
i2p::context.GetRouterInfo ().IsSSU2PeerTesting (ep.address ().is_v4 ())) |
|
|
|
i2p::context.GetRouterInfo ().IsSSU2PeerTesting (ep.address ().is_v4 ())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!m_Server.IsConnectedRecently (ep)) // no alive hole punch
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// send msg 5 to Alice
|
|
|
|
// send msg 5 to Alice
|
|
|
|
auto session = std::make_shared<SSU2Session> (m_Server, r, addr); |
|
|
|
auto session = std::make_shared<SSU2Session> (m_Server, r, addr); |
|
|
@ -2285,6 +2284,9 @@ namespace transport |
|
|
|
m_Server.AddSession (session); |
|
|
|
m_Server.AddSession (session); |
|
|
|
session->SendPeerTest (5, newSignedData.data (), newSignedData.size (), addr->i); |
|
|
|
session->SendPeerTest (5, newSignedData.data (), newSignedData.size (), addr->i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
code = eSSU2PeerTestCodeCharlieAliceIsAlreadyConnected; |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
code = eSSU2PeerTestCodeCharlieUnsupportedAddress; |
|
|
|
code = eSSU2PeerTestCodeCharlieUnsupportedAddress; |
|
|
|
} |
|
|
|
} |
|
|
|