reuse single buffers

This commit is contained in:
onyx-and-iris 2024-09-28 00:38:55 +01:00
parent 826756eb6e
commit 6cd90ae1dd
2 changed files with 2 additions and 2 deletions

View File

@ -38,8 +38,8 @@ func newSession(caddr *net.UDPAddr, raddr *net.UDPAddr, proxyConn *net.UDPConn)
} }
func (s *session) listen() error { func (s *session) listen() error {
for {
buf := make([]byte, 2048) buf := make([]byte, 2048)
for {
n, err := s.serverConn.Read(buf) n, err := s.serverConn.Read(buf)
if err != nil { if err != nil {
log.Error(err) log.Error(err)

View File

@ -46,8 +46,8 @@ func (c *Client) ListenAndServe() error {
go c.pruneSessions() go c.pruneSessions()
for {
buf := make([]byte, 2048) buf := make([]byte, 2048)
for {
n, caddr, err := c.proxyConn.ReadFromUDP(buf) n, caddr, err := c.proxyConn.ReadFromUDP(buf)
if err != nil { if err != nil {
log.Error(err) log.Error(err)