Skip to content

Commit

Permalink
eliminate const value
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Mar 24, 2017
1 parent 4ac47f5 commit 74dfc18
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,9 +737,7 @@ func (kcp *KCP) flush(ackOnly bool) {

// counters
var lostSegs, fastRetransSegs, earlyRetransSegs uint64

change := 0
lost := false
var change, lost int
current := currentMs()
// check for retransmissions
for k := range kcp.snd_buf {
Expand All @@ -757,7 +755,7 @@ func (kcp *KCP) flush(ackOnly bool) {
segment.rto += kcp.rx_rto / 2
}
segment.resendts = current + segment.rto
lost = true
lost++
lostSegs++
} else if segment.fastack >= resent { // fast retransmit
needsend = true
Expand Down Expand Up @@ -836,7 +834,7 @@ func (kcp *KCP) flush(ackOnly bool) {
}

// congestion control, https://tools.ietf.org/html/rfc5681
if lost {
if lost > 0 {
kcp.ssthresh = cwnd / 2
if kcp.ssthresh < IKCP_THRESH_MIN {
kcp.ssthresh = IKCP_THRESH_MIN
Expand Down

0 comments on commit 74dfc18

Please sign in to comment.