tailscale/wireguard-go#116 changed the receive loop to retry any errors
other than net.ErrClosed without a delay. magicsock entered a spin loop
if it encountered a UDP read error.
magicsock's receive funcs now return only net.ErrClosed when the socket
actually closes. Every other read error is counted, logged, and retried
after a short delay. IsUDPReadFeedback and IsUDPReadUnknown are removed
because they can be handled like any other error.
Retrying errors may hide failures which used to stop the receive func.
- There is a new metric magicsock_recv_udp_error which counts all read
errors.
- After 30s of continuous errors, the receive function marks itself as
broken. A warning is raised until a read succeeds.
Updates #22097
Change-Id: Ib9ade0ed001e413205eb7d452aa108aae574e0d1
Signed-off-by: Nick Beirne <[email protected]>