风扇滑翔翼
2026-04-16 00:57:51 +08:00
committed by GitHub
parent 05e259c8e4
commit 3691741440
4 changed files with 24 additions and 14 deletions
+5 -6
View File
@@ -5,7 +5,7 @@ import (
"net"
"sync"
xbuf "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/bytespool"
"github.com/xtls/xray-core/common/errors"
)
@@ -150,11 +150,10 @@ type headerReadAddrAware interface {
func (c *headerManagerConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) {
buf := p
if len(buf) < UDPSize {
b := xbuf.NewWithSize(UDPSize)
defer b.Release()
b.Resize(0, UDPSize)
buf = b.Bytes()
b := bytespool.Alloc(UDPSize)
b = b[:UDPSize]
defer bytespool.Free(b)
buf = b
}
n, addr, err = c.PacketConn.ReadFrom(buf)