mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
tun: darwin: write routeSocket variable in helper
Otherwise the race detector "complains".
This commit is contained in:
parent
d9078fe772
commit
d024393335
@ -47,7 +47,10 @@ func (tun *NativeTun) routineRouteListener(tunIfindex int) {
|
||||
statusMTU int
|
||||
)
|
||||
|
||||
defer close(tun.events)
|
||||
defer func() {
|
||||
close(tun.events)
|
||||
tun.routeSocket = -1
|
||||
}()
|
||||
|
||||
data := make([]byte, os.Getpagesize())
|
||||
for {
|
||||
@ -292,7 +295,6 @@ func (tun *NativeTun) Close() error {
|
||||
if tun.routeSocket != -1 {
|
||||
unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
|
||||
err2 = unix.Close(tun.routeSocket)
|
||||
tun.routeSocket = -1
|
||||
} else if tun.events != nil {
|
||||
close(tun.events)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user