Skip to content

Instantly share code, notes, and snippets.

@cawka
Created October 19, 2019 22:04
Show Gist options
  • Save cawka/a72f97bf98c49e3935a7738d8ff3406c to your computer and use it in GitHub Desktop.
Save cawka/a72f97bf98c49e3935a7738d8ff3406c to your computer and use it in GitHub Desktop.
rto = 3000
sample=0
x = [400.0, 200.0, 200.0, 200.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
srtt = 0
for i in x:
if srtt == 0:
srtt = i
devRtt = srtt / 2.0
else:
srtt = 7/8 * srtt + 1/8 * i
sample = abs(srtt - i)
devRtt = 3/4 * devRtt + 1/4 * sample
rto = srtt + 4 * devRtt
print(f"rtt_i={i},srtt={srtt}, devRtt={devRtt}, sample={sample}")
print(f"rto={rto}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment