mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:54:01 +01:00
pick 3 routers for SSU2 peer test
This commit is contained in:
parent
f7e9e6a1c4
commit
83f43ab166
|
@ -463,6 +463,7 @@ namespace transport
|
||||||
bool isValidEndpoint = !address->host.is_unspecified () && address->port;
|
bool isValidEndpoint = !address->host.is_unspecified () && address->port;
|
||||||
if (isValidEndpoint)
|
if (isValidEndpoint)
|
||||||
{
|
{
|
||||||
|
if (i2p::util::net::IsInReservedRange(address->host)) return false;
|
||||||
auto s = FindPendingOutgoingSession (boost::asio::ip::udp::endpoint (address->host, address->port));
|
auto s = FindPendingOutgoingSession (boost::asio::ip::udp::endpoint (address->host, address->port));
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1712,8 +1712,10 @@ namespace transport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "SSU2: Peer test 4 error code ", (int)buf[1]);
|
LogPrint (eLogInfo, "SSU2: Peer test 4 error code ", (int)buf[1], " from ",
|
||||||
SetRouterStatus (eRouterStatusUnknown);
|
i2p::data::GetIdentHashAbbreviation (buf[1] < 64 ? GetRemoteIdentity ()->GetIdentHash () : i2p::data::IdentHash (buf + 3)));
|
||||||
|
if (GetRouterStatus () == eRouterStatusTesting)
|
||||||
|
SetRouterStatus (eRouterStatusUnknown);
|
||||||
it->second.first->Terminate ();
|
it->second.first->Terminate ();
|
||||||
}
|
}
|
||||||
m_PeerTests.erase (it);
|
m_PeerTests.erase (it);
|
||||||
|
|
|
@ -665,11 +665,16 @@ namespace transport
|
||||||
{
|
{
|
||||||
excluded.clear ();
|
excluded.clear ();
|
||||||
excluded.insert (i2p::context.GetIdentHash ());
|
excluded.insert (i2p::context.GetIdentHash ());
|
||||||
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (true, excluded); // v4
|
for (int i = 0; i < 3; i++)
|
||||||
if (router)
|
{
|
||||||
{
|
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (true, excluded); // v4
|
||||||
i2p::context.SetStatusSSU2 (eRouterStatusTesting);
|
if (router)
|
||||||
m_SSU2Server->StartPeerTest (router, true);
|
{
|
||||||
|
if (i2p::context.GetStatus () != eRouterStatusTesting)
|
||||||
|
i2p::context.SetStatusSSU2 (eRouterStatusTesting);
|
||||||
|
m_SSU2Server->StartPeerTest (router, true);
|
||||||
|
excluded.insert (router->GetIdentHash ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,11 +713,16 @@ namespace transport
|
||||||
{
|
{
|
||||||
excluded.clear ();
|
excluded.clear ();
|
||||||
excluded.insert (i2p::context.GetIdentHash ());
|
excluded.insert (i2p::context.GetIdentHash ());
|
||||||
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (false, excluded); // v6
|
for (int i = 0; i < 3; i++)
|
||||||
if (router)
|
{
|
||||||
{
|
auto router = i2p::data::netdb.GetRandomSSU2PeerTestRouter (false, excluded); // v6
|
||||||
i2p::context.SetStatusV6SSU2 (eRouterStatusTesting);
|
if (router)
|
||||||
m_SSU2Server->StartPeerTest (router, false);
|
{
|
||||||
|
if (i2p::context.GetStatusV6 () != eRouterStatusTesting)
|
||||||
|
i2p::context.SetStatusV6SSU2 (eRouterStatusTesting);
|
||||||
|
m_SSU2Server->StartPeerTest (router, false);
|
||||||
|
}
|
||||||
|
excluded.insert (router->GetIdentHash ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue