From 6d78f895579b114c93bd493ad8d61316fc5dd15a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 2 Aug 2019 12:24:00 +0200 Subject: 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. --- tun/tun_darwin.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tun') 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 { -- cgit v1.2.3