refine rto settings

pull/215/head
v2ray 2016-06-27 17:05:01 +02:00
parent 52c6b9b60b
commit 27b8715b63
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 4 additions and 4 deletions

View File

@ -256,7 +256,7 @@ func (kcp *KCP) update_ack(rtt int32) {
if rto > IKCP_RTO_MAX { if rto > IKCP_RTO_MAX {
rto = IKCP_RTO_MAX rto = IKCP_RTO_MAX
} }
kcp.rx_rto = rto kcp.rx_rto = rto * 3 / 2
} }
func (kcp *KCP) shrink_buf() { func (kcp *KCP) shrink_buf() {
@ -510,18 +510,18 @@ func (kcp *KCP) flush() {
if segment.xmit == 0 { if segment.xmit == 0 {
needsend = true needsend = true
segment.xmit++ segment.xmit++
segment.resendts = current + (kcp.rx_rto * 3 / 2) + kcp.interval segment.resendts = current + kcp.rx_rto
} else if _itimediff(current, segment.resendts) >= 0 { } else if _itimediff(current, segment.resendts) >= 0 {
needsend = true needsend = true
segment.xmit++ segment.xmit++
kcp.xmit++ kcp.xmit++
segment.resendts = current + (kcp.rx_rto * 3 / 2) + kcp.interval segment.resendts = current + kcp.rx_rto
//lost = true //lost = true
} else if segment.fastack >= resent { } else if segment.fastack >= resent {
needsend = true needsend = true
segment.xmit++ segment.xmit++
segment.fastack = 0 segment.fastack = 0
segment.resendts = current + (kcp.rx_rto * 3 / 2) + kcp.interval segment.resendts = current + kcp.rx_rto
change++ change++
} }