diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-08 14:25:37 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-08 14:30:04 +0100 |
commit | ea6c1cd7e6525f76041d341074a0e10b800d4e13 (patch) | |
tree | 20d488a58b5d9960a509edce216540707d286704 /conn | |
parent | 3b3de758ec898e47aef609fbf16d78e97dac2000 (diff) |
device: receive: do not exit immediately on transient UDP receive errors
Some users report seeing lines like:
> Routine: receive incoming IPv4 - stopped
Popping up unexpectedly. Let's sleep and try again before failing, and
also log the error, and perhaps we'll eventually understand this
situation better in future versions.
Because we have to distinguish between the socket being closed
explicitly and whatever error this is, we bump the module to require Go
1.16.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'conn')
-rw-r--r-- | conn/conn_linux.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/conn/conn_linux.go b/conn/conn_linux.go index ef5c0ba..642ad7d 100644 --- a/conn/conn_linux.go +++ b/conn/conn_linux.go @@ -204,7 +204,7 @@ func (bind *nativeBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) { var end NativeEndpoint if bind.sock6 == -1 { - return 0, nil, syscall.EAFNOSUPPORT + return 0, nil, net.ErrClosed } n, err := receive6( bind.sock6, @@ -220,7 +220,7 @@ func (bind *nativeBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) { var end NativeEndpoint if bind.sock4 == -1 { - return 0, nil, syscall.EAFNOSUPPORT + return 0, nil, net.ErrClosed } n, err := receive4( bind.sock4, @@ -237,12 +237,12 @@ func (bind *nativeBind) Send(buff []byte, end Endpoint) error { nend := end.(*NativeEndpoint) if !nend.isV6 { if bind.sock4 == -1 { - return syscall.EAFNOSUPPORT + return net.ErrClosed } return send4(bind.sock4, nend, buff) } else { if bind.sock6 == -1 { - return syscall.EAFNOSUPPORT + return net.ErrClosed } return send6(bind.sock6, nend, buff) } |