mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-09 11:27:53 +00:00
exclude false position OK peer test if comes from recently connected endpoint
This commit is contained in:
parent
db19c32381
commit
7ef1fdf634
@ -2365,10 +2365,11 @@ namespace transport
|
|||||||
if (addr)
|
if (addr)
|
||||||
{
|
{
|
||||||
it->second.first->m_Address = addr;
|
it->second.first->m_Address = addr;
|
||||||
if (it->second.first->m_State == eSSU2SessionStatePeerTestReceived)
|
auto state = it->second.first->m_State;
|
||||||
|
if (state == eSSU2SessionStatePeerTestReceived || state == eSSU2SessionStateVoidPeerTestReceived)
|
||||||
{
|
{
|
||||||
// msg 5 already received. send msg 6
|
// msg 5 already received. send msg 6
|
||||||
SetRouterStatus (eRouterStatusOK);
|
SetRouterStatus (state == eSSU2SessionStatePeerTestReceived ? eRouterStatusOK : eRouterStatusUnknown);
|
||||||
it->second.first->m_State = eSSU2SessionStatePeerTest;
|
it->second.first->m_State = eSSU2SessionStatePeerTest;
|
||||||
it->second.first->SendPeerTest (6, buf + offset, len - offset, addr->i);
|
it->second.first->SendPeerTest (6, buf + offset, len - offset, addr->i);
|
||||||
}
|
}
|
||||||
@ -2426,14 +2427,15 @@ namespace transport
|
|||||||
case 5: // Alice from Charlie 1
|
case 5: // Alice from Charlie 1
|
||||||
if (htobe64 (((uint64_t)nonce << 32) | nonce) == m_SourceConnID)
|
if (htobe64 (((uint64_t)nonce << 32) | nonce) == m_SourceConnID)
|
||||||
{
|
{
|
||||||
|
bool isConnectedRecently = m_Server.IsConnectedRecently (m_RemoteEndpoint);
|
||||||
if (m_Address)
|
if (m_Address)
|
||||||
{
|
{
|
||||||
SetRouterStatus (eRouterStatusOK);
|
SetRouterStatus (isConnectedRecently ? eRouterStatusUnknown : eRouterStatusOK);
|
||||||
SendPeerTest (6, buf + offset, len - offset, m_Address->i);
|
SendPeerTest (6, buf + offset, len - offset, m_Address->i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// we received msg 5 before msg 4
|
// we received msg 5 before msg 4
|
||||||
m_State = eSSU2SessionStatePeerTestReceived;
|
m_State = isConnectedRecently ? eSSU2SessionStateVoidPeerTestReceived : eSSU2SessionStatePeerTestReceived;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "SSU2: Peer test 5 nonce mismatch ", nonce, " connID=", m_SourceConnID);
|
LogPrint (eLogWarning, "SSU2: Peer test 5 nonce mismatch ", nonce, " connID=", m_SourceConnID);
|
||||||
|
@ -114,6 +114,7 @@ namespace transport
|
|||||||
eSSU2SessionStateIntroduced,
|
eSSU2SessionStateIntroduced,
|
||||||
eSSU2SessionStatePeerTest,
|
eSSU2SessionStatePeerTest,
|
||||||
eSSU2SessionStatePeerTestReceived, // 5 before 4
|
eSSU2SessionStatePeerTestReceived, // 5 before 4
|
||||||
|
eSSU2SessionStateVoidPeerTestReceived, // 5 before 4, but from connected recently
|
||||||
eSSU2SessionStateTokenRequestReceived
|
eSSU2SessionStateTokenRequestReceived
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user