mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
select compatible outbound tunnel
This commit is contained in:
parent
632d41e50c
commit
73b77c83b8
|
@ -204,10 +204,16 @@ namespace client
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel ();
|
auto leases = remote->GetNonExpiredLeases (false); // without threshold
|
||||||
auto leases = remote->GetNonExpiredLeases ();
|
if (leases.empty ())
|
||||||
|
leases = remote->GetNonExpiredLeases (true); // with threshold
|
||||||
if (!leases.empty ())
|
if (!leases.empty ())
|
||||||
|
{
|
||||||
remoteLease = leases[rand () % leases.size ()];
|
remoteLease = leases[rand () % leases.size ()];
|
||||||
|
auto leaseRouter = i2p::data::netdb.FindRouter (remoteLease->tunnelGateway);
|
||||||
|
outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (nullptr,
|
||||||
|
leaseRouter ? leaseRouter->GetCompatibleTransports (false) : (i2p::data::RouterInfo::CompatibleTransports)i2p::data::RouterInfo::eAllTransports);
|
||||||
|
}
|
||||||
if (remoteLease && outboundTunnel)
|
if (remoteLease && outboundTunnel)
|
||||||
remoteSession->SetSharedRoutingPath (std::make_shared<i2p::garlic::GarlicRoutingPath> (
|
remoteSession->SetSharedRoutingPath (std::make_shared<i2p::garlic::GarlicRoutingPath> (
|
||||||
i2p::garlic::GarlicRoutingPath{outboundTunnel, remoteLease, 10000, 0, 0})); // 10 secs RTT
|
i2p::garlic::GarlicRoutingPath{outboundTunnel, remoteLease, 10000, 0, 0})); // 10 secs RTT
|
||||||
|
|
Loading…
Reference in a new issue