Skip to content

Commit

Permalink
Fix consistent udp packet loss after the proxy read loop stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
fatanugraha committed Sep 3, 2024
1 parent 2d3bdad commit 246bbbb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/services/forwarder/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ func UDP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mute
p, _ := NewUDPProxy(&autoStoppingListener{underlying: gonet.NewUDPConn(s, &wq, ep)}, func() (net.Conn, error) {
return net.Dial("udp", fmt.Sprintf("%s:%d", localAddress, r.ID().LocalPort))
})
go p.Run()
go func() {
p.Run()

// note that at this point packets that is sent to the current forwarder session
// will be dropped. we will start processing the packets again when we get new
// fowrarder request.
ep.Close()
}()
})
}

0 comments on commit 246bbbb

Please sign in to comment.