ソースを参照

locker protected ReceivingQueue.Put

v2ray 9 年 前
コミット
5680c69146
1 ファイル変更8 行追加0 行削除
  1. 8 0
      transport/internet/kcp/receiving.go

+ 8 - 0
transport/internet/kcp/receiving.go

@@ -118,6 +118,14 @@ L:
 }
 
 func (this *ReceivingQueue) Put(payload *alloc.Buffer) {
+	this.RLock()
+	defer this.RUnlock()
+
+	if this.closed {
+		payload.Release()
+		return
+	}
+
 	this.queue <- payload
 }