Browse Source

set router status to uknown if peer test msg 5 came from recently connected peer

pull/2101/head
orignal 2 months ago
parent
commit
5cd0248494
  1. 5
      libi2pd/SSU2Session.cpp
  2. 3
      libi2pd/SSU2Session.h

5
libi2pd/SSU2Session.cpp

@ -2362,6 +2362,7 @@ namespace transport @@ -2362,6 +2362,7 @@ namespace transport
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
{
SetRouterStatus (eRouterStatusFirewalled);
session->SetStatusChanged ();
if (m_Address->IsV4 ())
m_Server.RescheduleIntroducersUpdateTimer ();
else
@ -3093,7 +3094,7 @@ namespace transport @@ -3093,7 +3094,7 @@ namespace transport
SSU2PeerTestSession::SSU2PeerTestSession (SSU2Server& server, uint64_t sourceConnID, uint64_t destConnID):
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 (!destConnID) destConnID = ~sourceConnID;
@ -3162,6 +3163,8 @@ namespace transport @@ -3162,6 +3163,8 @@ namespace transport
{
if (!m_IsConnectedRecently)
SetRouterStatus (eRouterStatusOK);
else if (m_IsStatusChanged && GetRouterStatus () == eRouterStatusFirewalled)
SetRouterStatus (eRouterStatusUnknown);
SendPeerTest (6, buf + offset, len - offset, addr->i);
}
}

3
libi2pd/SSU2Session.h

@ -397,6 +397,7 @@ namespace transport @@ -397,6 +397,7 @@ namespace transport
uint8_t GetMsgNumReceived () const { return m_MsgNumReceived; }
bool IsConnectedRecently () const { return m_IsConnectedRecently; }
void SetStatusChanged () { m_IsStatusChanged = true; }
bool ProcessPeerTest (uint8_t * buf, size_t len) override;
private:
@ -406,7 +407,7 @@ namespace transport @@ -406,7 +407,7 @@ namespace transport
private:
uint8_t m_MsgNumReceived;
bool m_IsConnectedRecently;
bool m_IsConnectedRecently, m_IsStatusChanged;
};
inline uint64_t CreateHeaderMask (const uint8_t * kh, const uint8_t * nonce)

Loading…
Cancel
Save