mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-04 20:37:43 +03:00
Fix darwin monitor
This commit is contained in:
parent
d174625727
commit
63f6630a0a
1 changed files with 6 additions and 1 deletions
|
@ -57,14 +57,19 @@ func (m *networkUpdateMonitor) loopUpdate0() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = unix.SetNonblock(routeSocket, true)
|
||||||
|
if err != nil {
|
||||||
|
unix.Close(routeSocket)
|
||||||
|
return err
|
||||||
|
}
|
||||||
routeSocketFile := os.NewFile(uintptr(routeSocket), "route")
|
routeSocketFile := os.NewFile(uintptr(routeSocket), "route")
|
||||||
|
defer routeSocketFile.Close()
|
||||||
m.routeSocketFile = routeSocketFile
|
m.routeSocketFile = routeSocketFile
|
||||||
m.loopUpdate1(routeSocketFile)
|
m.loopUpdate1(routeSocketFile)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *networkUpdateMonitor) loopUpdate1(routeSocketFile *os.File) {
|
func (m *networkUpdateMonitor) loopUpdate1(routeSocketFile *os.File) {
|
||||||
defer routeSocketFile.Close()
|
|
||||||
buffer := buf.NewPacket()
|
buffer := buf.NewPacket()
|
||||||
defer buffer.Release()
|
defer buffer.Release()
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue