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.
This commit is contained in:
Jason A. Donenfeld 2019-08-02 12:24:00 +02:00
parent a2249449d6
commit 6d78f89557

View File

@ -48,10 +48,7 @@ func (tun *NativeTun) routineRouteListener(tunIfindex int) {
statusMTU int statusMTU int
) )
defer func() { defer close(tun.events)
close(tun.events)
tun.routeSocket = -1
}()
data := make([]byte, os.Getpagesize()) data := make([]byte, os.Getpagesize())
for { for {