mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
fix: use background context for DNS listeners to survive reloads
Change DNS listener context from parent context to background context so that listeners continue running during configuration reloads. Listener configuration changes require a service restart, not reload, so listeners must persist across reload operations. This prevents DNS listeners from being terminated when the parent context is cancelled during reload operations.
This commit is contained in:
committed by
Cuong Manh Le
parent
5d87bd07ca
commit
a084c87370
@@ -532,7 +532,10 @@ func (p *prog) run(reload bool, reloadCh chan struct{}) {
|
||||
}
|
||||
addr := net.JoinHostPort(listenerConfig.IP, strconv.Itoa(listenerConfig.Port))
|
||||
p.Info().Msgf("starting DNS server on listener.%s: %s", listenerNum, addr)
|
||||
if err := p.serveDNS(ctx, listenerNum); err != nil {
|
||||
// serveCtx uses Background() context so listeners survive between reloads.
|
||||
// Changes to listeners config require a service restart, not just reload.
|
||||
serveCtx := context.Background()
|
||||
if err := p.serveDNS(serveCtx, listenerNum); err != nil {
|
||||
p.Fatal().Err(err).Msgf("unable to start dns proxy on listener.%s", listenerNum)
|
||||
}
|
||||
p.Debug().Msgf("end of serveDNS listener.%s: %s", listenerNum, addr)
|
||||
|
||||
Reference in New Issue
Block a user