Unpool handshake

Anyway, we are going to use stack here, no need for connection pooling.
Even arrays are allocaed on a stack because we do not use slices here
but real ones.
This commit is contained in:
9seconds
2021-03-18 22:06:52 +03:00
parent 188fa6a04a
commit 8de727932d
2 changed files with 20 additions and 36 deletions
+5 -20
View File
@@ -6,18 +6,11 @@ import (
"sync"
)
var (
sha256HasherPool = sync.Pool{
New: func() interface{} {
return sha256.New()
},
}
handshakeFramePool = sync.Pool{
New: func() interface{} {
return &handshakeFrame{}
},
}
)
var sha256HasherPool = sync.Pool{
New: func() interface{} {
return sha256.New()
},
}
func acquireSha256Hasher() hash.Hash {
return sha256HasherPool.Get().(hash.Hash)
@@ -27,11 +20,3 @@ func releaseSha256Hasher(h hash.Hash) {
h.Reset()
sha256HasherPool.Put(h)
}
func acquireHandshakeFrame() *handshakeFrame {
return handshakeFramePool.Get().(*handshakeFrame)
}
func releaseHandshakeFrame(h *handshakeFrame) {
handshakeFramePool.Put(h)
}