Commit 7f03717a authored by AlexStocks's avatar AlexStocks

Imp: use bytes.Bytes from memory pool

parent f40d3daf
......@@ -621,9 +621,16 @@ func (s *session) handleTCPPackage() error {
// buf = make([]byte, maxReadBufLen)
bufp = gxbytes.GetBytes(maxReadBufLen)
defer gxbytes.PutBytes(bufp)
buf = *bufp
pktBuf = new(bytes.Buffer)
// pktBuf = new(bytes.Buffer)
pktBuf = gxbytes.GetBytesBuffer()
defer func() {
gxbytes.PutBytes(bufp)
gxbytes.PutBytesBuffer(pktBuf)
}()
conn = s.Connection.(*gettyTCPConn)
for {
if s.IsClosed() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment