use pointer to byte slices in the buffer pool

https://staticcheck.io/docs/staticcheck#SA6002 suggests to use pointers
to objects in the sync.Pool.
This commit is contained in:
Marten Seemann
2018-02-21 22:37:08 +08:00
parent d16dea09cc
commit 07b8821ef7
8 changed files with 21 additions and 30 deletions

View File

@@ -245,7 +245,7 @@ func (c *client) listen() {
for {
var n int
var addr net.Addr
data := getPacketBuffer()
data := *getPacketBuffer()
data = data[:protocol.MaxReceivePacketSize]
// The packet size should not exceed protocol.MaxReceivePacketSize bytes
// If it does, we only read a truncated packet, which will then end up undecryptable