aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-02 12:24:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-02 12:24:17 +0200
commit6d78f895579b114c93bd493ad8d61316fc5dd15a (patch)
treea254a5ac7c1b61fd58266e8733d6a36525686a9e
parentwintun: get interface path properly with cfgmgr (diff)
downloadwireguard-go-6d78f895579b114c93bd493ad8d61316fc5dd15a.tar.xz
wireguard-go-6d78f895579b114c93bd493ad8d61316fc5dd15a.zip
tun: darwin: do not attempt to close tun.event twice
Previously it was possible for this to race. It turns out we really don't need to set anything to -1 anyway.
-rw-r--r--tun/tun_darwin.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go
index 0815495..6d2e6dd 100644
--- a/tun/tun_darwin.go
+++ b/tun/tun_darwin.go
@@ -48,10 +48,7 @@ func (tun *NativeTun) routineRouteListener(tunIfindex int) {
statusMTU int
)
- defer func() {
- close(tun.events)
- tun.routeSocket = -1
- }()
+ defer close(tun.events)
data := make([]byte, os.Getpagesize())
for {