Get rid of unrequired buffering for tls records

This commit is contained in:
9seconds
2021-03-29 18:56:08 +03:00
parent 3cacd74e12
commit 841a4d2227
3 changed files with 19 additions and 35 deletions
+5 -22
View File
@@ -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)
}