From 0eaa3ba27ac9dbb6eae5004db08db2066e345991 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 3 Jul 2016 09:38:51 +0200 Subject: [PATCH] refactor code --- transport/internet/kcp/receiving.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/transport/internet/kcp/receiving.go b/transport/internet/kcp/receiving.go index b83fa15ed..c23cf370c 100644 --- a/transport/internet/kcp/receiving.go +++ b/transport/internet/kcp/receiving.go @@ -255,19 +255,11 @@ func (this *ReceivingWorker) ProcessSegment(seg *DataSegment) { this.ProcessSendingNext(seg.SendingNext) this.acklist.Add(number, seg.Timestamp) this.windowMutex.Lock() + defer this.windowMutex.Unlock() if !this.window.Set(idx, seg) { seg.Release() } - this.windowMutex.Unlock() - - this.DumpWindow() -} - -// @Private -func (this *ReceivingWorker) DumpWindow() { - this.windowMutex.Lock() - defer this.windowMutex.Unlock() for { seg := this.window.RemoveFirst()