Stopping the static proxy config should unregister from DNS monitor.

This commit is contained in:
Joachim Bauch 2024-02-22 14:06:05 +01:00
parent 7e613f831b
commit 29b0b06f6d
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -151,6 +151,10 @@ func (p *proxyConfigStatic) Start() error {
if p.dnsDiscovery {
for u, ips := range p.connectionsMap {
if ips.entry != nil {
continue
}
entry, err := p.dnsMonitor.Add(u, p.onLookup)
if err != nil {
return err
@ -170,6 +174,19 @@ func (p *proxyConfigStatic) Start() error {
}
func (p *proxyConfigStatic) Stop() {
p.mu.Lock()
defer p.mu.Unlock()
if p.dnsDiscovery {
for _, ips := range p.connectionsMap {
if ips.entry == nil {
continue
}
p.dnsMonitor.Remove(ips.entry)
ips.entry = nil
}
}
}
func (p *proxyConfigStatic) Reload(config *goconf.ConfigFile) error {