mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 18:24:02 +03:00
FILE / ScuroNeko/mtg
obfuscated2/frame_pool.go
Исходный файл и его история в репозитории.
25 lines
427 B
Go
25 lines
427 B
Go
package obfuscated2
|
|
|
|
import "sync"
|
|
|
|
var framePool sync.Pool
|
|
|
|
// MakeFrame returns new pointer to the handshake frame.
|
|
func MakeFrame() *Frame {
|
|
return framePool.Get().(*Frame)
|
|
}
|
|
|
|
// ReturnFrame returns pointer to the handshake frame back to the pool.
|
|
func ReturnFrame(f *Frame) {
|
|
framePool.Put(f)
|
|
}
|
|
|
|
func init() {
|
|
framePool = sync.Pool{
|
|
New: func() interface{} {
|
|
data := make(Frame, FrameLen)
|
|
return &data
|
|
},
|
|
}
|
|
}
|