Skip to content

Commit

Permalink
Fix monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 12, 2024
1 parent d105263 commit 858d089
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 4 additions & 5 deletions monitor_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ func (m *networkUpdateMonitor) Close() error {
}

func (m *defaultInterfaceMonitor) checkUpdate() error {
err := m.interfaceFinder.Update()
if err != nil {
return E.Cause(err, "update interfaces")
}
var defaultInterface *control.Interface
var (
defaultInterface *control.Interface
err error
)
if m.underNetworkExtension {
defaultInterface, err = m.getDefaultInterfaceBySocket()
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion monitor_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ func (m *defaultInterfaceMonitor) delayCheckUpdate() {
}

func (m *defaultInterfaceMonitor) postCheckUpdate() {
err := m.checkUpdate()
err := m.interfaceFinder.Update()
if err != nil {
m.logger.Error("update interface: ", err)
return
}
err = m.checkUpdate()
if errors.Is(err, ErrNoRoute) {
if !m.noRoute {
m.noRoute = true
Expand Down

0 comments on commit 858d089

Please sign in to comment.