mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 04:47:38 +02:00
use clear()
This commit is contained in:
@@ -48,9 +48,7 @@ func (p *Passthrough) Flush() error {
|
|||||||
firstErr = err
|
firstErr = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := range p.slots {
|
clear(p.slots)
|
||||||
p.slots[i] = nil
|
|
||||||
}
|
|
||||||
p.slots = p.slots[:0]
|
p.slots = p.slots[:0]
|
||||||
p.backing = p.backing[:0]
|
p.backing = p.backing[:0]
|
||||||
return firstErr
|
return firstErr
|
||||||
|
|||||||
@@ -266,13 +266,9 @@ func (c *TCPCoalescer) Flush() error {
|
|||||||
}
|
}
|
||||||
c.release(s)
|
c.release(s)
|
||||||
}
|
}
|
||||||
for i := range c.slots {
|
clear(c.slots)
|
||||||
c.slots[i] = nil
|
|
||||||
}
|
|
||||||
c.slots = c.slots[:0]
|
c.slots = c.slots[:0]
|
||||||
for k := range c.openSlots {
|
clear(c.openSlots)
|
||||||
delete(c.openSlots, k)
|
|
||||||
}
|
|
||||||
c.lastSlot = nil
|
c.lastSlot = nil
|
||||||
|
|
||||||
c.backing = c.backing[:0]
|
c.backing = c.backing[:0]
|
||||||
@@ -383,9 +379,7 @@ func (c *TCPCoalescer) take() *coalesceSlot {
|
|||||||
func (c *TCPCoalescer) release(s *coalesceSlot) {
|
func (c *TCPCoalescer) release(s *coalesceSlot) {
|
||||||
s.passthrough = false
|
s.passthrough = false
|
||||||
s.rawPkt = nil
|
s.rawPkt = nil
|
||||||
for i := range s.payIovs {
|
clear(s.payIovs)
|
||||||
s.payIovs[i] = nil
|
|
||||||
}
|
|
||||||
s.payIovs = s.payIovs[:0]
|
s.payIovs = s.payIovs[:0]
|
||||||
s.numSeg = 0
|
s.numSeg = 0
|
||||||
s.totalPay = 0
|
s.totalPay = 0
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ func (b *SendBatch) Flush() error {
|
|||||||
if len(b.bufs) > 0 {
|
if len(b.bufs) > 0 {
|
||||||
err = b.out.WriteBatch(b.bufs, b.dsts, b.ecns)
|
err = b.out.WriteBatch(b.bufs, b.dsts, b.ecns)
|
||||||
}
|
}
|
||||||
for i := range b.bufs {
|
clear(b.bufs)
|
||||||
b.bufs[i] = nil
|
|
||||||
}
|
|
||||||
b.bufs = b.bufs[:0]
|
b.bufs = b.bufs[:0]
|
||||||
b.dsts = b.dsts[:0]
|
b.dsts = b.dsts[:0]
|
||||||
b.ecns = b.ecns[:0]
|
b.ecns = b.ecns[:0]
|
||||||
|
|||||||
@@ -180,13 +180,9 @@ func (c *UDPCoalescer) Flush() error {
|
|||||||
}
|
}
|
||||||
c.release(s)
|
c.release(s)
|
||||||
}
|
}
|
||||||
for i := range c.slots {
|
clear(c.slots)
|
||||||
c.slots[i] = nil
|
|
||||||
}
|
|
||||||
c.slots = c.slots[:0]
|
c.slots = c.slots[:0]
|
||||||
for k := range c.openSlots {
|
clear(c.openSlots)
|
||||||
delete(c.openSlots, k)
|
|
||||||
}
|
|
||||||
c.backing = c.backing[:0]
|
c.backing = c.backing[:0]
|
||||||
return first
|
return first
|
||||||
}
|
}
|
||||||
@@ -270,9 +266,7 @@ func (c *UDPCoalescer) take() *udpSlot {
|
|||||||
func (c *UDPCoalescer) release(s *udpSlot) {
|
func (c *UDPCoalescer) release(s *udpSlot) {
|
||||||
s.passthrough = false
|
s.passthrough = false
|
||||||
s.rawPkt = nil
|
s.rawPkt = nil
|
||||||
for i := range s.payIovs {
|
clear(s.payIovs)
|
||||||
s.payIovs[i] = nil
|
|
||||||
}
|
|
||||||
s.payIovs = s.payIovs[:0]
|
s.payIovs = s.payIovs[:0]
|
||||||
s.numSeg = 0
|
s.numSeg = 0
|
||||||
s.totalPay = 0
|
s.totalPay = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user