Skip to content

Commit

Permalink
faster RTT recalculation if bad sample
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Sep 11, 2024
1 parent 272bf7d commit 78ec5b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libi2pd/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ namespace stream
if (m_IsImmediateAckRequested)
{
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
m_RTT = (m_RTT + (ts - m_LastSendTime)) / 2;
if (m_IsFirstRttSample)
{
m_RTT = ts - m_LastSendTime;
m_IsFirstRttSample = false;
}
else
m_RTT = (m_RTT + (ts - m_LastSendTime)) / 2;
m_IsImmediateAckRequested = false;
}
}
Expand Down

0 comments on commit 78ec5b2

Please sign in to comment.