mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
try to select reachable router of inbound tunnel gateway
This commit is contained in:
parent
7c8280934a
commit
484f69f16b
@ -414,7 +414,8 @@ namespace tunnel
|
|||||||
else if (i2p::transport::transports.GetNumPeers () > 25)
|
else if (i2p::transport::transports.GetNumPeers () > 25)
|
||||||
{
|
{
|
||||||
auto r = i2p::transport::transports.GetRandomPeer ();
|
auto r = i2p::transport::transports.GetRandomPeer ();
|
||||||
if (r && !r->GetProfile ()->IsBad ())
|
if (r && !r->GetProfile ()->IsBad () &&
|
||||||
|
(numHops > 1 || !inbound || r->IsReachable ())) // first must be reachable
|
||||||
{
|
{
|
||||||
prevHop = r;
|
prevHop = r;
|
||||||
peers.push_back (r->GetRouterIdentity ());
|
peers.push_back (r->GetRouterIdentity ());
|
||||||
@ -430,6 +431,12 @@ namespace tunnel
|
|||||||
LogPrint (eLogError, "Tunnels: Can't select next hop for ", prevHop->GetIdentHashBase64 ());
|
LogPrint (eLogError, "Tunnels: Can't select next hop for ", prevHop->GetIdentHashBase64 ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (inbound && (i == numHops - 1) && !hop->IsReachable ())
|
||||||
|
{
|
||||||
|
// if first is not reachable try again
|
||||||
|
auto hop1 = nextHop (prevHop);
|
||||||
|
if (hop1) hop = hop1;
|
||||||
|
}
|
||||||
prevHop = hop;
|
prevHop = hop;
|
||||||
peers.push_back (hop->GetRouterIdentity ());
|
peers.push_back (hop->GetRouterIdentity ());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user