mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
connect to SSU2 address
This commit is contained in:
parent
7473d8c9aa
commit
3c5c375f71
5 changed files with 96 additions and 32 deletions
|
@ -536,6 +536,40 @@ namespace transport
|
|||
}
|
||||
}
|
||||
}
|
||||
if (peer.numAttempts == 5 || peer.numAttempts == 6) // SSU2
|
||||
{
|
||||
if (m_SSU2Server)
|
||||
{
|
||||
std::shared_ptr<const RouterInfo::Address> address;
|
||||
if (peer.numAttempts == 5) // SSU2 ipv6
|
||||
{
|
||||
if (context.GetRouterInfo ().IsSSU2V6 () && peer.router->IsReachableBy (RouterInfo::eSSU2V6))
|
||||
{
|
||||
address = peer.router->GetSSU2V6Address ();
|
||||
if (address && m_CheckReserved && i2p::util::net::IsInReservedRange(address->host))
|
||||
address = nullptr;
|
||||
}
|
||||
peer.numAttempts++;
|
||||
}
|
||||
if (!address && peer.numAttempts == 6) // SSU2 ipv4
|
||||
{
|
||||
if (context.GetRouterInfo ().IsSSU2V4 () && peer.router->IsReachableBy (RouterInfo::eSSU2V4))
|
||||
{
|
||||
address = peer.router->GetSSU2V4Address ();
|
||||
if (address && m_CheckReserved && i2p::util::net::IsInReservedRange(address->host))
|
||||
address = nullptr;
|
||||
}
|
||||
peer.numAttempts++;
|
||||
}
|
||||
if (address && address->published)
|
||||
{
|
||||
if (m_SSU2Server->CreateSession (peer.router, address))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
peer.numAttempts += 2;
|
||||
}
|
||||
LogPrint (eLogInfo, "Transports: No compatble NTCP2 or SSU addresses available");
|
||||
i2p::data::netdb.SetUnreachable (ident, true); // we are here because all connection attempts failed
|
||||
peer.Done ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue