mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-27 13:14:15 +00:00
when selecting tunnels if we can't find a low latency tunnel fall back to regular selection algorithm
This commit is contained in:
parent
fc94e846a6
commit
7fef5f5654
@ -147,18 +147,26 @@ namespace tunnel
|
||||
|
||||
std::shared_ptr<OutboundTunnel> TunnelPool::GetNextOutboundTunnel (std::shared_ptr<OutboundTunnel> excluded) const
|
||||
{
|
||||
std::shared_ptr<OutboundTunnel> tun = nullptr;
|
||||
if (HasLatencyRequriement())
|
||||
return GetLowestLatencyOutboundTunnel(excluded);
|
||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||
return GetNextTunnel (m_OutboundTunnels, excluded);
|
||||
tun = GetLowestLatencyOutboundTunnel(excluded);
|
||||
if (! tun) {
|
||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||
tun = GetNextTunnel (m_OutboundTunnels, excluded);
|
||||
}
|
||||
return tun;
|
||||
}
|
||||
|
||||
std::shared_ptr<InboundTunnel> TunnelPool::GetNextInboundTunnel (std::shared_ptr<InboundTunnel> excluded) const
|
||||
{
|
||||
std::shared_ptr<InboundTunnel> tun = nullptr;
|
||||
if (HasLatencyRequriement())
|
||||
return GetLowestLatencyInboundTunnel(excluded);
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
return GetNextTunnel (m_InboundTunnels, excluded);
|
||||
tun = GetLowestLatencyInboundTunnel(excluded);
|
||||
if (! tun) {
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
tun = GetNextTunnel (m_InboundTunnels, excluded);
|
||||
}
|
||||
return tun;
|
||||
}
|
||||
|
||||
template<class TTunnels>
|
||||
|
Loading…
x
Reference in New Issue
Block a user