Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions KCP/KCP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,18 +432,19 @@ void update_ack(Int32 rtt)
else
{
Int32 delta = (Int32)((UInt32)rtt - rx_srtt);
rx_srtt += (UInt32)(delta >> 3);
if (0 > delta) delta = -delta;

if (rtt < rx_srtt - rx_rttval)
{
// if the new RTT sample is below the bottom of the range of
// what an RTT measurement is expected to be.
// give an 8x reduced weight versus its normal weighting
rx_rttval += ((uint)delta - rx_rttval) >> 5;
// give an 8x reduced weight versus its normal weighting
rx_rttval += (uint)((delta - rx_rttval) >> 5);
}
else
{
rx_rttval += ((uint)delta - rx_rttval) >> 2;
rx_rttval += (uint)((delta - rx_rttval) >> 2);
}
}

Expand Down