mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
342 B
Go
25 lines
342 B
Go
package proxy
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
const (
|
|
DefaultBufferSize = 16 * 1024
|
|
)
|
|
|
|
var sharedBufferPool = sync.Pool{
|
|
New: func() interface{} {
|
|
buffer := make([]byte, DefaultBufferSize)
|
|
return &buffer
|
|
},
|
|
}
|
|
|
|
func getBuffer() *[]byte {
|
|
return sharedBufferPool.Get().(*[]byte)
|
|
}
|
|
|
|
func putBuffer(buffer *[]byte) {
|
|
sharedBufferPool.Put(buffer)
|
|
}
|