From d398e4b01c399790f72ffa6b8019d04cee7c671f Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Tue, 3 Nov 2020 17:44:03 +0300 Subject: [PATCH] Pull request: 2250 config reload fix Merge in DNS/adguard-home from 2250-config-reload-fix to master Closes #2250. Squashed commit of the following: commit 928f28a0732c14f24576de02d0a9fcd34f484c63 Author: Vladislav Alekseev Date: Mon Nov 2 02:53:51 2020 +0300 TLS: use correct config on reload after receiving SIGHUP commit 9e10d84cf9fbf3298d7f426903dfa4f20f39024b Author: Vladislav Alekseev Date: Mon Nov 2 02:52:32 2020 +0300 Service: reload config (-s reload): fix for parsing application pid if 'ps' return space padded value --- internal/home/service.go | 2 +- internal/home/tls.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/home/service.go b/internal/home/service.go index c3551143..8087d097 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -104,7 +104,7 @@ func sendSigReload() { return } - pid, err := strconv.Atoi(parts[0]) + pid, err := strconv.Atoi(strings.TrimSpace(parts[0])) if err != nil { log.Error("Can't read PID file %s: %s", pidfile, err) return diff --git a/internal/home/tls.go b/internal/home/tls.go index d9ab356a..a6a90aaf 100644 --- a/internal/home/tls.go +++ b/internal/home/tls.go @@ -136,6 +136,10 @@ func (t *TLSMod) Reload() { t.certLastMod = fi.ModTime().UTC() _ = reconfigureDNSServer() + + t.confLock.Lock() + tlsConf = t.conf + t.confLock.Unlock() Context.web.TLSConfigChanged(tlsConf) }