Selaa lähdekoodia

locker protected ReceivingQueue.Put

v2ray 9 vuotta sitten
vanhempi
commit
5680c69146
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  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
 }