Browse Source

don't blow up

pull/709/head
Jeff Becker 8 years ago
parent
commit
76c9b66db4
  1. 11
      Tunnel.cpp
  2. 2
      TunnelPool.cpp

11
Tunnel.cpp

@ -36,10 +36,13 @@ namespace tunnel @@ -36,10 +36,13 @@ namespace tunnel
TunnelLatency::Latency TunnelLatency::GetMeanLatency() const
{
std::unique_lock<std::mutex> lock(m_access);
Latency l = 0;
for(auto s : m_samples)
l += s;
return l / m_samples.size();
if (m_samples.size() > 0) {
Latency l = 0;
for(auto s : m_samples)
l += s;
return l / m_samples.size();
}
return 0;
}

2
TunnelPool.cpp

@ -167,7 +167,7 @@ namespace tunnel @@ -167,7 +167,7 @@ namespace tunnel
{
if (it->IsEstablished () && it != excluded)
{
if(HasLatencyRequirement() && !it->LatencyFitsRange(m_MinLatency, m_MaxLatency)) {
if(HasLatencyRequirement() && it->LatencyIsKnown() && !it->LatencyFitsRange(m_MinLatency, m_MaxLatency)) {
i ++;
continue;
}

Loading…
Cancel
Save