github.com/tumi8/quic-go@v0.37.4-tum/noninternal/wire/ack_frame_pool.go (about) 1 package wire 2 3 import "sync" 4 5 var ackFramePool = sync.Pool{New: func() any { 6 return &AckFrame{} 7 }} 8 9 func GetAckFrame() *AckFrame { 10 f := ackFramePool.Get().(*AckFrame) 11 f.AckRanges = f.AckRanges[:0] 12 f.ECNCE = 0 13 f.ECT0 = 0 14 f.ECT1 = 0 15 f.DelayTime = 0 16 return f 17 } 18 19 func PutAckFrame(f *AckFrame) { 20 if cap(f.AckRanges) > 4 { 21 return 22 } 23 ackFramePool.Put(f) 24 }