Fix buffer usage

This commit is contained in:
世界 2022-08-01 20:48:08 +08:00
parent 1bb95f9661
commit 842fd713ff
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
10 changed files with 15 additions and 61 deletions

View file

@ -63,10 +63,7 @@ func HandleConnection(ctx context.Context, conn net.Conn, reader *std_bufio.Read
var requestConn net.Conn
if reader.Buffered() > 0 {
_buffer := buf.StackNewSize(reader.Buffered())
defer common.KeepAlive(_buffer)
buffer := common.Dup(_buffer)
defer buffer.Release()
buffer := buf.NewSize(reader.Buffered())
_, err = buffer.ReadFullFrom(reader, reader.Buffered())
if err != nil {
return err