Browse Source

pick 3 routers for SSU2 peer test

pull/1774/head
orignal 2 years ago
parent
commit
83f43ab166
  1. 1
      libi2pd/SSU2.cpp
  2. 4
      libi2pd/SSU2Session.cpp
  3. 10
      libi2pd/Transports.cpp

1
libi2pd/SSU2.cpp

@ -463,6 +463,7 @@ namespace transport @@ -463,6 +463,7 @@ namespace transport
bool isValidEndpoint = !address->host.is_unspecified () && address->port;
if (isValidEndpoint)
{
if (i2p::util::net::IsInReservedRange(address->host)) return false;
auto s = FindPendingOutgoingSession (boost::asio::ip::udp::endpoint (address->host, address->port));
if (s)
{

4
libi2pd/SSU2Session.cpp

@ -1712,7 +1712,9 @@ namespace transport @@ -1712,7 +1712,9 @@ namespace transport
}
else
{
LogPrint (eLogInfo, "SSU2: Peer test 4 error code ", (int)buf[1]);
LogPrint (eLogInfo, "SSU2: Peer test 4 error code ", (int)buf[1], " from ",
i2p::data::GetIdentHashAbbreviation (buf[1] < 64 ? GetRemoteIdentity ()->GetIdentHash () : i2p::data::IdentHash (buf + 3)));
if (GetRouterStatus () == eRouterStatusTesting)
SetRouterStatus (eRouterStatusUnknown);
it->second.first->Terminate ();
}

10
libi2pd/Transports.cpp

@ -665,11 +665,16 @@ namespace transport @@ -665,11 +665,16 @@ namespace transport
{
excluded.clear ();
excluded.insert (i2p::context.GetIdentHash ());
for (int i = 0; i < 3; i++)
{
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (true, excluded); // v4
if (router)
{
if (i2p::context.GetStatus () != eRouterStatusTesting)
i2p::context.SetStatusSSU2 (eRouterStatusTesting);
m_SSU2Server->StartPeerTest (router, true);
excluded.insert (router->GetIdentHash ());
}
}
}
}
@ -708,12 +713,17 @@ namespace transport @@ -708,12 +713,17 @@ namespace transport
{
excluded.clear ();
excluded.insert (i2p::context.GetIdentHash ());
for (int i = 0; i < 3; i++)
{
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (false, excluded); // v6
if (router)
{
if (i2p::context.GetStatusV6 () != eRouterStatusTesting)
i2p::context.SetStatusV6SSU2 (eRouterStatusTesting);
m_SSU2Server->StartPeerTest (router, false);
}
excluded.insert (router->GetIdentHash ());
}
}
}
}

Loading…
Cancel
Save