mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02:00
fix leakingQueryReset usages
This commit is contained in:
@@ -1255,10 +1255,6 @@ func (p *prog) reinitializeOSResolver(networkChange bool) {
|
|||||||
defer p.resetCtxMu.Unlock()
|
defer p.resetCtxMu.Unlock()
|
||||||
|
|
||||||
p.leakingQueryReset.Store(true)
|
p.leakingQueryReset.Store(true)
|
||||||
defer func() {
|
|
||||||
time.Sleep(time.Second)
|
|
||||||
p.leakingQueryReset.Store(false)
|
|
||||||
}()
|
|
||||||
|
|
||||||
mainLog.Load().Debug().Msg("attempting to reset DNS")
|
mainLog.Load().Debug().Msg("attempting to reset DNS")
|
||||||
// Remove the listener immediately.
|
// Remove the listener immediately.
|
||||||
@@ -1281,9 +1277,6 @@ func (p *prog) reinitializeOSResolver(networkChange bool) {
|
|||||||
|
|
||||||
// Launch a goroutine that monitors the non-OS upstreams.
|
// Launch a goroutine that monitors the non-OS upstreams.
|
||||||
go func() {
|
go func() {
|
||||||
p.leakingQueryReset.Store(true)
|
|
||||||
defer p.leakingQueryReset.Store(false)
|
|
||||||
|
|
||||||
recoveredUpstream, err := p.waitForNonOSResolverRecovery(ctx)
|
recoveredUpstream, err := p.waitForNonOSResolverRecovery(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mainLog.Load().Warn().Err(err).Msg("No non-OS upstream recovered within the timeout; not re-enabling the listener")
|
mainLog.Load().Warn().Err(err).Msg("No non-OS upstream recovered within the timeout; not re-enabling the listener")
|
||||||
@@ -1304,6 +1297,9 @@ func (p *prog) reinitializeOSResolver(networkChange bool) {
|
|||||||
p.setDNS()
|
p.setDNS()
|
||||||
p.logInterfacesState()
|
p.logInterfacesState()
|
||||||
|
|
||||||
|
// allow watchers to reset changes
|
||||||
|
p.leakingQueryReset.Store(false)
|
||||||
|
|
||||||
// Clear the recovery cancel func as recovery has been achieved.
|
// Clear the recovery cancel func as recovery has been achieved.
|
||||||
p.recoveryCancelMu.Lock()
|
p.recoveryCancelMu.Lock()
|
||||||
p.recoveryCancel = nil
|
p.recoveryCancel = nil
|
||||||
@@ -1322,6 +1318,9 @@ func (p *prog) reinitializeOSResolver(networkChange bool) {
|
|||||||
// For non-network-change cases, immediately re-enable the listener.
|
// For non-network-change cases, immediately re-enable the listener.
|
||||||
p.setDNS()
|
p.setDNS()
|
||||||
p.logInterfacesState()
|
p.logInterfacesState()
|
||||||
|
|
||||||
|
// allow watchers to reset changes
|
||||||
|
p.leakingQueryReset.Store(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user