diff --git a/monitor_darwin.go b/monitor_darwin.go index 65e9330..3cdd344 100644 --- a/monitor_darwin.go +++ b/monitor_darwin.go @@ -107,10 +107,6 @@ 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 if m.underNetworkExtension { defaultInterface, err = m.getDefaultInterfaceBySocket() diff --git a/monitor_shared.go b/monitor_shared.go index f4d0e97..d742906 100644 --- a/monitor_shared.go +++ b/monitor_shared.go @@ -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