Cleanup pools from wrappes

This commit is contained in:
9seconds
2020-08-10 13:29:08 +03:00
parent 95b16cd805
commit 86a8f69273
9 changed files with 14 additions and 89 deletions
@@ -1,6 +1,7 @@
package packetack
import (
"bytes"
"encoding/binary"
"fmt"
"math/rand"
@@ -34,10 +35,9 @@ func (w *wrapperClientIntermediateSecure) Write(packet conntypes.Packet, acks *c
return nil
}
buf := acquireClientBytesBuffer()
defer releaseClientBytesBuffer(buf)
buf := &bytes.Buffer{}
paddingLength := rand.Intn(4)
buf.Grow(4 + len(packet) + paddingLength)
binary.Write(buf, binary.LittleEndian, uint32(len(packet)+paddingLength)) // nolint: errcheck