[client] Fix shared sock buffer allocation (#4409)

This commit is contained in:
Viktor Liu
2025-08-28 13:25:16 +02:00
committed by GitHub
parent 99bd34c02a
commit aa595c3073

View File

@@ -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():