diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 14:16:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 14:16:46 +0200 |
commit | 837a12c84151968fac6477f75d6bcb52e7ae64db (patch) | |
tree | 7d02bac68d391e3fe63882bc7dfca300530e6a59 /tun_darwin.go | |
parent | 7472930d4e7b908646f87adf638188857566a7c6 (diff) |
Close events channel when no status listener
Diffstat (limited to 'tun_darwin.go')
-rw-r--r-- | tun_darwin.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tun_darwin.go b/tun_darwin.go index d2cdcd5..b8afdfd 100644 --- a/tun_darwin.go +++ b/tun_darwin.go @@ -303,6 +303,9 @@ func (tun *NativeTun) Close() error { // 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. err3 = unix.Close(tun.routeSocket) + tun.routeSocket = -1 + } else if tun.events != nil { + close(tun.events) } if err1 != nil { return err1 |