Skip to content

Commit

Permalink
Fix darwin monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed May 3, 2024
1 parent d174625 commit 63f6630
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion monitor_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ func (m *networkUpdateMonitor) loopUpdate0() error {
if err != nil {
return err
}
err = unix.SetNonblock(routeSocket, true)
if err != nil {
unix.Close(routeSocket)
return err
}
routeSocketFile := os.NewFile(uintptr(routeSocket), "route")
defer routeSocketFile.Close()
m.routeSocketFile = routeSocketFile
m.loopUpdate1(routeSocketFile)
return nil
}

func (m *networkUpdateMonitor) loopUpdate1(routeSocketFile *os.File) {
defer routeSocketFile.Close()
buffer := buf.NewPacket()
defer buffer.Release()
done := make(chan struct{})
Expand Down

0 comments on commit 63f6630

Please sign in to comment.