From: Jason A. Donenfeld Date: Fri, 2 Aug 2019 10:24:00 +0000 (+0200) Subject: tun: darwin: do not attempt to close tun.event twice X-Git-Tag: 0.0.20190805~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d78f895579b114c93bd493ad8d61316fc5dd15a;p=thirdparty%2Fwireguard-go.git 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. --- 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 {