mirror of https://github.com/oxen-io/lokinet
path testing interval increase to reduce bandwidth use
This commit is contained in:
parent
00143e63f4
commit
382e4215a8
|
@ -31,9 +31,9 @@ namespace llarp
|
|||
constexpr auto build_timeout = 30s;
|
||||
|
||||
/// measure latency every this interval ms
|
||||
constexpr auto latency_interval = 5s;
|
||||
constexpr auto latency_interval = 20s;
|
||||
/// if a path is inactive for this amount of time it's dead
|
||||
constexpr auto alive_timeout = 30s;
|
||||
constexpr auto alive_timeout = latency_interval * 1.5;
|
||||
} // namespace path
|
||||
} // namespace llarp
|
||||
|
||||
|
|
|
@ -378,9 +378,12 @@ namespace llarp
|
|||
// check to see if this path is dead
|
||||
if (_status == ePathEstablished)
|
||||
{
|
||||
const auto dlt = now - m_LastLatencyTestTime;
|
||||
auto dlt = now - m_LastLatencyTestTime;
|
||||
if (dlt > path::latency_interval && m_LastLatencyTestID == 0)
|
||||
{
|
||||
// bail doing test if we are active
|
||||
if (now - m_LastRecvMessage < path::latency_interval)
|
||||
return;
|
||||
routing::PathLatencyMessage latency;
|
||||
latency.T = randint();
|
||||
m_LastLatencyTestID = latency.T;
|
||||
|
@ -389,24 +392,12 @@ namespace llarp
|
|||
FlushUpstream(r);
|
||||
return;
|
||||
}
|
||||
if (m_LastRecvMessage > 0s && now > m_LastRecvMessage)
|
||||
dlt = now - m_LastRecvMessage;
|
||||
if (dlt >= path::alive_timeout)
|
||||
{
|
||||
const auto delay = now - m_LastRecvMessage;
|
||||
if (m_CheckForDead && m_CheckForDead(shared_from_this(), delay))
|
||||
{
|
||||
LogWarn(Name(), " waited for ", dlt, " and path is unresponsive");
|
||||
r->routerProfiling().MarkPathFail(this);
|
||||
EnterState(ePathTimeout, now);
|
||||
}
|
||||
}
|
||||
else if (dlt >= path::alive_timeout && m_LastRecvMessage == 0s)
|
||||
{
|
||||
if (m_CheckForDead && m_CheckForDead(shared_from_this(), dlt))
|
||||
{
|
||||
LogWarn(Name(), " waited for ", dlt, " and path looks dead");
|
||||
r->routerProfiling().MarkPathFail(this);
|
||||
EnterState(ePathTimeout, now);
|
||||
}
|
||||
LogWarn(Name(), " waited for ", dlt, " and path looks dead");
|
||||
r->routerProfiling().MarkPathFail(this);
|
||||
EnterState(ePathTimeout, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue