mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-27 14:59:09 +01: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
|
// read start a read loop for a specific receiver and sends the packet to the packetDemux channel
|
||||||
func (s *SharedSocket) read(receiver receiver) {
|
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 {
|
for {
|
||||||
|
buf := make([]byte, s.mtu+maxIPUDPOverhead)
|
||||||
n, addr, err := receiver(s.ctx, buf, 0)
|
n, addr, err := receiver(s.ctx, buf, 0)
|
||||||
select {
|
select {
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
|
|||||||
Reference in New Issue
Block a user