From aa595c3073231cc0aa33e7d4d9581181129c8bb3 Mon Sep 17 00:00:00 2001 From: Viktor Liu <17948409+lixmal@users.noreply.github.com> Date: Thu, 28 Aug 2025 13:25:16 +0200 Subject: [PATCH] [client] Fix shared sock buffer allocation (#4409) --- sharedsock/sock_linux.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sharedsock/sock_linux.go b/sharedsock/sock_linux.go index db428515b..d4fedc492 100644 --- a/sharedsock/sock_linux.go +++ b/sharedsock/sock_linux.go @@ -230,10 +230,8 @@ func (s *SharedSocket) Close() error { // read start a read loop for a specific receiver and sends the packet to the packetDemux channel func (s *SharedSocket) read(receiver receiver) { - // Buffer reuse is safe: packetDemux is unbuffered, so read() blocks until - // ReadFrom() synchronously processes the packet before next iteration - buf := make([]byte, s.mtu+maxIPUDPOverhead) for { + buf := make([]byte, s.mtu+maxIPUDPOverhead) n, addr, err := receiver(s.ctx, buf, 0) select { case <-s.ctx.Done():