correct srtt boundary

pull/215/head
v2ray 2016-06-27 09:14:30 +02:00
parent 231f5fc140
commit 2e63b29191
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 2 deletions

View File

@ -263,8 +263,8 @@ func (kcp *KCP) update_ack(rtt int32) {
} }
kcp.rx_rttvar = (3*kcp.rx_rttvar + uint32(delta)) / 4 kcp.rx_rttvar = (3*kcp.rx_rttvar + uint32(delta)) / 4
kcp.rx_srtt = (7*kcp.rx_srtt + uint32(rtt)) / 8 kcp.rx_srtt = (7*kcp.rx_srtt + uint32(rtt)) / 8
if kcp.rx_srtt < 1 { if kcp.rx_srtt < kcp.interval {
kcp.rx_srtt = 1 kcp.rx_srtt = kcp.interval
} }
} }
rto = kcp.rx_srtt + _imax_(kcp.interval, 4*kcp.rx_rttvar) rto = kcp.rx_srtt + _imax_(kcp.interval, 4*kcp.rx_rttvar)