From 9d83fbcb7c038c770e7a8ab762b8dc1ccd802928 Mon Sep 17 00:00:00 2001 From: v2ray Date: Thu, 30 Jun 2016 11:19:35 +0200 Subject: [PATCH] fix cwnd --- transport/internet/kcp/kcp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/internet/kcp/kcp.go b/transport/internet/kcp/kcp.go index ea3859a1a..abdee6362 100644 --- a/transport/internet/kcp/kcp.go +++ b/transport/internet/kcp/kcp.go @@ -423,8 +423,8 @@ func (kcp *KCP) flush() { // calculate window size cwnd := _imin_(kcp.snd_una+kcp.snd_wnd, kcp.rmt_wnd) - if kcp.congestionControl { - cwnd = _imin_(kcp.cwnd, cwnd) + if kcp.congestionControl && cwnd < kcp.snd_una+kcp.cwnd { + cwnd = kcp.snd_una + kcp.cwnd } for !kcp.snd_queue.IsEmpty() && _itimediff(kcp.snd_nxt, cwnd) < 0 {