]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
tun: darwin: do not attempt to close tun.event twice
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 2 Aug 2019 10:24:00 +0000 (12:24 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 2 Aug 2019 10:24:17 +0000 (12:24 +0200)
Previously it was possible for this to race. It turns out we really
don't need to set anything to -1 anyway.

tun/tun_darwin.go

index 0815495d513cc21a1eed72f39905aa4af911e512..6d2e6dd4a9bc1da0f39b76f5a40d038393a12949 100644 (file)
@@ -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 {