diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-22 01:27:29 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-22 01:27:29 +0200 |
commit | 8462c08cf2c968386374c81d0e9dafb904483f8c (patch) | |
tree | d97ac0fc22913b0c0ad0cc06fe3fb82a5d8a9d83 /tun_darwin.go | |
parent | b8c9e13c6e0db93133dc302b40e25b615fece9b8 (diff) |
Just in case darwin changes, we also shutdown
Diffstat (limited to 'tun_darwin.go')
-rw-r--r-- | tun_darwin.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tun_darwin.go b/tun_darwin.go index 772f311..d43be94 100644 --- a/tun_darwin.go +++ b/tun_darwin.go @@ -298,8 +298,7 @@ func (tun *NativeTun) Close() error { err1 := tun.rwcancel.Cancel() err2 := tun.fd.Close() if tun.routeSocket != -1 { - // Surprisingly, on Darwin, simply closing a route socket is enough to unblock it. - // We don't even need to call shutdown, or use a rwcancel. + unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR) err3 = unix.Close(tun.routeSocket) tun.routeSocket = -1 } else if tun.events != nil { |