Closed virt00l closed 4 years ago
I did a hand merge of these changes, as there were some formatting/style issues I wanted to correct. Also, I wanted to leave the initial roundTripTime value untouched as external users might depend on that, so I tracked initialization of the first ack via lastReceiveTime instead. I credited you in the commit.
This commit contains several fixes/improvements
1) Calculation of roundTripTimeVariance was performed slightly incorrectly - it used new updated value of roundTripTime, as opposed to prev one, which should be used as described in https://tools.ietf.org/html/rfc6298#section-2 (Pt 2.3)
2) Apply/implement optimization from linux kernel for cases when RTT drops below (SRTT - RTTVAR) threshold, as described in "TCP/IP illustrated Volume 1" by Richard Stevens"
see also https://github.com/torvalds/linux/blob/master/net/ipv4/tcp_input.c#L760
3) Also change initial value & calculation of roundTripTime as described here https://tools.ietf.org/html/rfc6298#section-2 (Pt 2.2)
This should improve handling of RTO, esp on initial messages and/or low latency networks