diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-24 15:29:16 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-24 15:36:29 +0200 |
commit | 2f2eca894744baef365aaa07554f56979159d988 (patch) | |
tree | 56ecc658ff124222643a13ed9bd75c3a703e726b /tun/tun_linux.go | |
parent | 66f6ca3e4a435935c38b93c4441575e3b003137d (diff) |
Catch EINTR
Diffstat (limited to 'tun/tun_linux.go')
-rw-r--r-- | tun/tun_linux.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tun/tun_linux.go b/tun/tun_linux.go index d048c21..2119696 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -12,10 +12,10 @@ package tun */ import ( - "git.zx2c4.com/wireguard-go/rwcancel" "bytes" "errors" "fmt" + "git.zx2c4.com/wireguard-go/rwcancel" "golang.org/x/net/ipv6" "golang.org/x/sys/unix" "net" @@ -102,7 +102,7 @@ func (tun *nativeTun) routineNetlinkListener() { var msgn int for { msgn, _, _, _, err = unix.Recvmsg(tun.netlinkSock, msg[:], nil, 0) - if err == nil || !rwcancel.ErrorIsEAGAIN(err) { + if err == nil || !rwcancel.RetryAfterError(err) { break } if !tun.netlinkCancel.ReadyRead() { @@ -334,7 +334,7 @@ func (tun *nativeTun) doRead(buff []byte, offset int) (int, error) { func (tun *nativeTun) Read(buff []byte, offset int) (int, error) { for { n, err := tun.doRead(buff, offset) - if err == nil || !rwcancel.ErrorIsEAGAIN(err) { + if err == nil || !rwcancel.RetryAfterError(err) { return n, err } if !tun.fdCancel.ReadyRead() { |