mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
pool: added bufio.Reader pool
This commit is contained in:
1 parent
c15c55fe05
commit
417ac556f7
29 files changed
+188
-168
No files matched your search
@@ -44,16 +44,16 @@ func NewSSTCPConn(c net.Conn, cipher *cipher.StreamCipher) *SSTCPConn {
|
||||
Conn: c,
|
||||
StreamCipher: cipher,
|
||||
readBuf: pool.GetBuffer(bufSize),
|
||||
decryptedBuf: pool.GetWriteBuffer(),
|
||||
underPostdecryptBuf: pool.GetWriteBuffer(),
|
||||
decryptedBuf: pool.GetBytesBuffer(),
|
||||
underPostdecryptBuf: pool.GetBytesBuffer(),
|
||||
writeBuf: pool.GetBuffer(bufSize),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *SSTCPConn) Close() error {
|
||||
pool.PutBuffer(c.readBuf)
|
||||
pool.PutWriteBuffer(c.decryptedBuf)
|
||||
pool.PutWriteBuffer(c.underPostdecryptBuf)
|
||||
pool.PutBytesBuffer(c.decryptedBuf)
|
||||
pool.PutBytesBuffer(c.underPostdecryptBuf)
|
||||
pool.PutBuffer(c.writeBuf)
|
||||
return c.Conn.Close()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user