mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-19 01:09:58 +00:00
check if remote router supports peer test
This commit is contained in:
parent
2f2f14e3a7
commit
1292ec67c0
@ -856,8 +856,11 @@ namespace transport
|
|||||||
auto it = m_SessionsByRouterHash.find (router->GetIdentHash ());
|
auto it = m_SessionsByRouterHash.find (router->GetIdentHash ());
|
||||||
if (it != m_SessionsByRouterHash.end ())
|
if (it != m_SessionsByRouterHash.end ())
|
||||||
{
|
{
|
||||||
auto s = it->second;
|
auto remoteAddr = it->second->GetAddress ();
|
||||||
if (it->second->IsEstablished ())
|
if (!remoteAddr || !remoteAddr->IsPeerTesting () ||
|
||||||
|
(v4 && !addr->IsV4 ()) || (!v4 && !addr->IsV6 ())) return false;
|
||||||
|
auto s = it->second;
|
||||||
|
if (s->IsEstablished ())
|
||||||
GetService ().post ([s]() { s->SendPeerTest (); });
|
GetService ().post ([s]() { s->SendPeerTest (); });
|
||||||
else
|
else
|
||||||
s->SetOnEstablished ([s]() { s->SendPeerTest (); });
|
s->SetOnEstablished ([s]() { s->SendPeerTest (); });
|
||||||
|
@ -2287,7 +2287,7 @@ namespace transport
|
|||||||
if (GetTestingState ())
|
if (GetTestingState ())
|
||||||
{
|
{
|
||||||
SetTestingState (false);
|
SetTestingState (false);
|
||||||
if (GetRouterStatus () != eRouterStatusFirewalled)
|
if (GetRouterStatus () != eRouterStatusFirewalled && addr->IsPeerTesting ())
|
||||||
{
|
{
|
||||||
SetRouterStatus (eRouterStatusFirewalled);
|
SetRouterStatus (eRouterStatusFirewalled);
|
||||||
if (m_Address->IsV4 ())
|
if (m_Address->IsV4 ())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user