Skip to content

Commit

Permalink
no need to manual recycle hi-freq data
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Jan 4, 2019
1 parent 2b63a96 commit 4624417
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ func (kcp *KCP) flush(ackOnly bool) uint32 {
kcp.snd_buf = append(kcp.snd_buf, newseg)
kcp.snd_nxt++
newSegsCount++
kcp.snd_queue[k].data = nil
}
if newSegsCount > 0 {
kcp.snd_queue = kcp.remove_front(kcp.snd_queue, newSegsCount)
Expand Down Expand Up @@ -1008,9 +1007,5 @@ func (kcp *KCP) WaitSnd() int {
// remove front n elements from queue
func (kcp *KCP) remove_front(q []segment, n int) []segment {
newn := copy(q, q[n:])
gc := q[newn:]
for k := range gc {
gc[k].data = nil // de-ref data
}
return q[:newn]
}

0 comments on commit 4624417

Please sign in to comment.