mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
set router status to uknown if peer test msg 5 came from recently connected peer
This commit is contained in:
parent
816771dd00
commit
5cd0248494
|
@ -2362,6 +2362,7 @@ namespace transport
|
||||||
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
|
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
|
||||||
{
|
{
|
||||||
SetRouterStatus (eRouterStatusFirewalled);
|
SetRouterStatus (eRouterStatusFirewalled);
|
||||||
|
session->SetStatusChanged ();
|
||||||
if (m_Address->IsV4 ())
|
if (m_Address->IsV4 ())
|
||||||
m_Server.RescheduleIntroducersUpdateTimer ();
|
m_Server.RescheduleIntroducersUpdateTimer ();
|
||||||
else
|
else
|
||||||
|
@ -3093,7 +3094,7 @@ namespace transport
|
||||||
|
|
||||||
SSU2PeerTestSession::SSU2PeerTestSession (SSU2Server& server, uint64_t sourceConnID, uint64_t destConnID):
|
SSU2PeerTestSession::SSU2PeerTestSession (SSU2Server& server, uint64_t sourceConnID, uint64_t destConnID):
|
||||||
SSU2Session (server, nullptr, nullptr, false),
|
SSU2Session (server, nullptr, nullptr, false),
|
||||||
m_MsgNumReceived (0), m_IsConnectedRecently (false)
|
m_MsgNumReceived (0), m_IsConnectedRecently (false), m_IsStatusChanged (false)
|
||||||
{
|
{
|
||||||
if (!sourceConnID) sourceConnID = ~destConnID;
|
if (!sourceConnID) sourceConnID = ~destConnID;
|
||||||
if (!destConnID) destConnID = ~sourceConnID;
|
if (!destConnID) destConnID = ~sourceConnID;
|
||||||
|
@ -3162,6 +3163,8 @@ namespace transport
|
||||||
{
|
{
|
||||||
if (!m_IsConnectedRecently)
|
if (!m_IsConnectedRecently)
|
||||||
SetRouterStatus (eRouterStatusOK);
|
SetRouterStatus (eRouterStatusOK);
|
||||||
|
else if (m_IsStatusChanged && GetRouterStatus () == eRouterStatusFirewalled)
|
||||||
|
SetRouterStatus (eRouterStatusUnknown);
|
||||||
SendPeerTest (6, buf + offset, len - offset, addr->i);
|
SendPeerTest (6, buf + offset, len - offset, addr->i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,6 +397,7 @@ namespace transport
|
||||||
|
|
||||||
uint8_t GetMsgNumReceived () const { return m_MsgNumReceived; }
|
uint8_t GetMsgNumReceived () const { return m_MsgNumReceived; }
|
||||||
bool IsConnectedRecently () const { return m_IsConnectedRecently; }
|
bool IsConnectedRecently () const { return m_IsConnectedRecently; }
|
||||||
|
void SetStatusChanged () { m_IsStatusChanged = true; }
|
||||||
bool ProcessPeerTest (uint8_t * buf, size_t len) override;
|
bool ProcessPeerTest (uint8_t * buf, size_t len) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -406,7 +407,7 @@ namespace transport
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint8_t m_MsgNumReceived;
|
uint8_t m_MsgNumReceived;
|
||||||
bool m_IsConnectedRecently;
|
bool m_IsConnectedRecently, m_IsStatusChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline uint64_t CreateHeaderMask (const uint8_t * kh, const uint8_t * nonce)
|
inline uint64_t CreateHeaderMask (const uint8_t * kh, const uint8_t * nonce)
|
||||||
|
|
Loading…
Reference in a new issue