From: Jason A. Donenfeld Date: Mon, 21 May 2018 23:27:29 +0000 (+0200) Subject: Just in case darwin changes, we also shutdown X-Git-Tag: 0.0.20180524~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8462c08cf2c968386374c81d0e9dafb904483f8c;p=thirdparty%2Fwireguard-go.git Just in case darwin changes, we also shutdown --- 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 {