Переглянути джерело

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
 }