瀏覽代碼

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
 }