mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 17:26:40 +00:00
Skip DNS cleanup on network monitor restart
This commit is contained in:
@@ -208,6 +208,10 @@ type Engine struct {
|
|||||||
shutdownWg sync.WaitGroup
|
shutdownWg sync.WaitGroup
|
||||||
|
|
||||||
probeStunTurn *relay.StunTurnProbe
|
probeStunTurn *relay.StunTurnProbe
|
||||||
|
|
||||||
|
// skipDNSCleanup is set when restarting due to network monitor to avoid
|
||||||
|
// unnecessary DNS cleanup/restore cycles
|
||||||
|
skipDNSCleanup bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peer is an instance of the Connection Peer
|
// Peer is an instance of the Connection Peer
|
||||||
@@ -1752,6 +1756,7 @@ func (e *Engine) startNetworkMonitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Network monitor: detected network change, triggering client restart")
|
log.Infof("Network monitor: detected network change, triggering client restart")
|
||||||
|
e.skipDNSCleanup = true
|
||||||
e.triggerClientRestart()
|
e.triggerClientRestart()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -1775,6 +1780,13 @@ func (e *Engine) stopDNSServer() {
|
|||||||
if e.dnsServer == nil {
|
if e.dnsServer == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if e.skipDNSCleanup {
|
||||||
|
log.Info("skipping DNS cleanup due to network monitor restart")
|
||||||
|
e.dnsServer = nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
e.dnsServer.Stop()
|
e.dnsServer.Stop()
|
||||||
e.dnsServer = nil
|
e.dnsServer = nil
|
||||||
err := fmt.Errorf("DNS server stopped")
|
err := fmt.Errorf("DNS server stopped")
|
||||||
|
|||||||
Reference in New Issue
Block a user