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
|
statusMTU int
|
||||||
)
|
)
|
||||||
|
|
||||||
defer close(tun.events)
|
defer func() {
|
||||||
|
close(tun.events)
|
||||||
|
tun.routeSocket = -1
|
||||||
|
}()
|
||||||
|
|
||||||
data := make([]byte, os.Getpagesize())
|
data := make([]byte, os.Getpagesize())
|
||||||
for {
|
for {
|
||||||
@ -292,7 +295,6 @@ func (tun *NativeTun) Close() error {
|
|||||||
if tun.routeSocket != -1 {
|
if tun.routeSocket != -1 {
|
||||||
unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
|
unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
|
||||||
err2 = unix.Close(tun.routeSocket)
|
err2 = unix.Close(tun.routeSocket)
|
||||||
tun.routeSocket = -1
|
|
||||||
} else if tun.events != nil {
|
} else if tun.events != nil {
|
||||||
close(tun.events)
|
close(tun.events)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user