mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 20:07:38 +03:00
Fix buffer usage
This commit is contained in:
parent
1bb95f9661
commit
842fd713ff
10 changed files with 15 additions and 61 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue