]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Just in case darwin changes, we also shutdown
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 May 2018 23:27:29 +0000 (01:27 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 May 2018 23:27:29 +0000 (01:27 +0200)
tun_darwin.go

index 772f31114f99744f9c0e879cd2e8dc6eb741e64b..d43be94154f55668499d26f0c2e3ae00dfe4e387 100644 (file)
@@ -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 {