release memory in kcp connection

This commit is contained in:
Darien Raymond
2016-11-21 22:41:12 +01:00
parent 70c75038a2
commit 15cb543abb
3 changed files with 19 additions and 0 deletions
+13
View File
@@ -36,6 +36,15 @@ func NewSendingWindow(size uint32, writer SegmentWriter, onPacketLoss func(uint3
return window
}
func (this *SendingWindow) Release() {
if this == nil {
return
}
for _, seg := range this.data {
seg.Release()
}
}
func (this *SendingWindow) Len() int {
return int(this.len)
}
@@ -192,6 +201,10 @@ func NewSendingWorker(kcp *Connection) *SendingWorker {
return worker
}
func (this *SendingWorker) Release() {
this.window.Release()
}
func (this *SendingWorker) ProcessReceivingNext(nextNumber uint32) {
this.Lock()
defer this.Unlock()