Skip to content

Commit

Permalink
upd earlyretrans calc
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Nov 5, 2016
1 parent 8ab0a9a commit bba2d62
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,16 @@ func (kcp *KCP) flush() {
segment.resendts = current + segment.rto
change++
fastRetransSegs++
} else if segment.fastack > 0 && !hasPending &&
_itimediff(segment.resendts, current) < 3*int32(kcp.rx_rto/4) {
// early retransmit
needsend = true
segment.xmit++
segment.fastack = 0
segment.resendts = current + segment.rto
change++
earlyRetransSegs++
} else if segment.fastack > 0 && !hasPending { // early retransmit
lastsend := segment.resendts - segment.rto
if _itimediff(current, lastsend) > int32(kcp.rx_rto/4) { // 1/4 rtt
needsend = true
segment.xmit++
segment.fastack = 0
segment.resendts = current + segment.rto
change++
earlyRetransSegs++
}
}

if needsend {
Expand Down

0 comments on commit bba2d62

Please sign in to comment.