mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 07:16:38 +00:00
[client] Fix shared sock buffer allocation (#4409)
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user