Browse Source

check if remote router supports peer test

pull/2035/head
orignal 10 months ago
parent
commit
1292ec67c0
  1. 7
      libi2pd/SSU2.cpp
  2. 2
      libi2pd/SSU2Session.cpp

7
libi2pd/SSU2.cpp

@ -856,8 +856,11 @@ namespace transport @@ -856,8 +856,11 @@ namespace transport
auto it = m_SessionsByRouterHash.find (router->GetIdentHash ());
if (it != m_SessionsByRouterHash.end ())
{
auto s = it->second;
if (it->second->IsEstablished ())
auto remoteAddr = it->second->GetAddress ();
if (!remoteAddr || !remoteAddr->IsPeerTesting () ||
(v4 && !addr->IsV4 ()) || (!v4 && !addr->IsV6 ())) return false;
auto s = it->second;
if (s->IsEstablished ())
GetService ().post ([s]() { s->SendPeerTest (); });
else
s->SetOnEstablished ([s]() { s->SendPeerTest (); });

2
libi2pd/SSU2Session.cpp

@ -2287,7 +2287,7 @@ namespace transport @@ -2287,7 +2287,7 @@ namespace transport
if (GetTestingState ())
{
SetTestingState (false);
if (GetRouterStatus () != eRouterStatusFirewalled)
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
{
SetRouterStatus (eRouterStatusFirewalled);
if (m_Address->IsV4 ())

Loading…
Cancel
Save