From 84889117e95e7eb438917b18ca618b8385b6d876 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 3 Jul 2016 00:38:33 +0200 Subject: [PATCH] simplify logic --- transport/internet/kcp/receiving.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/transport/internet/kcp/receiving.go b/transport/internet/kcp/receiving.go index 66caf483..b83fa15e 100644 --- a/transport/internet/kcp/receiving.go +++ b/transport/internet/kcp/receiving.go @@ -248,15 +248,13 @@ func (this *ReceivingWorker) ProcessSendingNext(number uint32) { func (this *ReceivingWorker) ProcessSegment(seg *DataSegment) { number := seg.Number - if _itimediff(number, this.nextNumber+this.windowSize) >= 0 || _itimediff(number, this.nextNumber) < 0 { + idx := number - this.nextNumber + if idx >= this.windowSize { return } - this.ProcessSendingNext(seg.SendingNext) - this.acklist.Add(number, seg.Timestamp) this.windowMutex.Lock() - idx := number - this.nextNumber if !this.window.Set(idx, seg) { seg.Release()