mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 18:34:02 +03:00
Reuse buffers on socket pumping
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package proxy
|
||||
|
||||
import "sync"
|
||||
|
||||
const copyBufferSize = 30 * 1024
|
||||
|
||||
var copyPool sync.Pool
|
||||
|
||||
func init() {
|
||||
copyPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
data := make([]byte, copyBufferSize)
|
||||
return &data
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user