tune RTT calculations

This commit is contained in:
Vort 2024-03-15 09:06:33 +02:00
parent 5412e29ff5
commit d74033dd2b
4 changed files with 15 additions and 8 deletions

View file

@ -434,7 +434,7 @@ namespace stream
rtt = 1;
}
if (seqn)
m_RTT = std::round (RTT_EWMA_ALPHA * m_RTT + (1.0 - RTT_EWMA_ALPHA) * rtt);
m_RTT = RTT_EWMA_ALPHA * rtt + (1.0 - RTT_EWMA_ALPHA) * m_RTT;
else
m_RTT = rtt;
m_RTO = m_RTT*1.5; // TODO: implement it better
@ -457,7 +457,7 @@ namespace stream
if (!seqn && m_RoutingSession) // first message confirmed
m_RoutingSession->SetSharedRoutingPath (
std::make_shared<i2p::garlic::GarlicRoutingPath> (
i2p::garlic::GarlicRoutingPath{m_CurrentOutboundTunnel, m_CurrentRemoteLease, m_RTT, 0, 0}));
i2p::garlic::GarlicRoutingPath{m_CurrentOutboundTunnel, m_CurrentRemoteLease, (int)m_RTT, 0, 0}));
}
else
break;