mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
don't blow up
This commit is contained in:
parent
0c5ca28a14
commit
76c9b66db4
11
Tunnel.cpp
11
Tunnel.cpp
@ -36,10 +36,13 @@ namespace tunnel
|
|||||||
TunnelLatency::Latency TunnelLatency::GetMeanLatency() const
|
TunnelLatency::Latency TunnelLatency::GetMeanLatency() const
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_access);
|
std::unique_lock<std::mutex> lock(m_access);
|
||||||
Latency l = 0;
|
if (m_samples.size() > 0) {
|
||||||
for(auto s : m_samples)
|
Latency l = 0;
|
||||||
l += s;
|
for(auto s : m_samples)
|
||||||
return l / m_samples.size();
|
l += s;
|
||||||
|
return l / m_samples.size();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
if (it->IsEstablished () && it != excluded)
|
if (it->IsEstablished () && it != excluded)
|
||||||
{
|
{
|
||||||
if(HasLatencyRequirement() && !it->LatencyFitsRange(m_MinLatency, m_MaxLatency)) {
|
if(HasLatencyRequirement() && it->LatencyIsKnown() && !it->LatencyFitsRange(m_MinLatency, m_MaxLatency)) {
|
||||||
i ++;
|
i ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user