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
)
defer func() {
close(tun.events)
tun.routeSocket = -1
}()
defer close(tun.events)
data := make([]byte, os.Getpagesize())
for {