mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 08:14:02 +03:00
Get rid of unrequired buffering for tls records
This commit is contained in:
@@ -1,22 +1,14 @@
|
||||
package record
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
recordPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &Record{}
|
||||
},
|
||||
}
|
||||
bytesBufferPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &bytes.Buffer{}
|
||||
},
|
||||
}
|
||||
)
|
||||
var recordPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &Record{}
|
||||
},
|
||||
}
|
||||
|
||||
func AcquireRecord() *Record {
|
||||
return recordPool.Get().(*Record)
|
||||
@@ -26,12 +18,3 @@ func ReleaseRecord(r *Record) {
|
||||
r.Reset()
|
||||
recordPool.Put(r)
|
||||
}
|
||||
|
||||
func acquireBytesBuffer() *bytes.Buffer {
|
||||
return bytesBufferPool.Get().(*bytes.Buffer)
|
||||
}
|
||||
|
||||
func releaseBytesBuffer(buf *bytes.Buffer) {
|
||||
buf.Reset()
|
||||
bytesBufferPool.Put(buf)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user