Just in case darwin changes, we also shutdown
This commit is contained in:
parent
b8c9e13c6e
commit
8462c08cf2
@ -298,8 +298,7 @@ func (tun *NativeTun) Close() error {
|
|||||||
err1 := tun.rwcancel.Cancel()
|
err1 := tun.rwcancel.Cancel()
|
||||||
err2 := tun.fd.Close()
|
err2 := tun.fd.Close()
|
||||||
if tun.routeSocket != -1 {
|
if tun.routeSocket != -1 {
|
||||||
// Surprisingly, on Darwin, simply closing a route socket is enough to unblock it.
|
unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
|
||||||
// We don't even need to call shutdown, or use a rwcancel.
|
|
||||||
err3 = unix.Close(tun.routeSocket)
|
err3 = unix.Close(tun.routeSocket)
|
||||||
tun.routeSocket = -1
|
tun.routeSocket = -1
|
||||||
} else if tun.events != nil {
|
} else if tun.events != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user