Explorar o código

correctly release segments

v2ray %!s(int64=9) %!d(string=hai) anos
pai
achega
05ed05b9a0
Modificáronse 2 ficheiros con 3 adicións e 0 borrados
  1. 1 0
      transport/internet/kcp/connection.go
  2. 2 0
      transport/internet/kcp/sending.go

+ 1 - 0
transport/internet/kcp/connection.go

@@ -414,6 +414,7 @@ func (this *Connection) Input(data []byte) int {
 			}
 			this.sendingWorker.ProcessReceivingNext(seg.ReceivinNext)
 			this.receivingWorker.ProcessSendingNext(seg.SendingNext)
+			seg.Release()
 		default:
 		}
 	}

+ 2 - 0
transport/internet/kcp/sending.go

@@ -292,6 +292,8 @@ func (this *SendingWorker) ProcessAck(number uint32) {
 }
 
 func (this *SendingWorker) ProcessSegment(current uint32, seg *AckSegment) {
+	defer seg.Release()
+
 	this.Lock()
 	defer this.Unlock()