소스 검색

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
 }