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 <vldrus@gmail.com>
Date:   Mon Nov 2 02:53:51 2020 +0300

    TLS: use correct config on reload after receiving SIGHUP

commit 9e10d84cf9fbf3298d7f426903dfa4f20f39024b
Author: Vladislav Alekseev <vldrus@gmail.com>
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
This commit is contained in:
Ainar Garipov 2020-11-03 17:44:03 +03:00
parent df34ee5c09
commit d398e4b01c
2 changed files with 5 additions and 1 deletions

View File

@ -104,7 +104,7 @@ func sendSigReload() {
return return
} }
pid, err := strconv.Atoi(parts[0]) pid, err := strconv.Atoi(strings.TrimSpace(parts[0]))
if err != nil { if err != nil {
log.Error("Can't read PID file %s: %s", pidfile, err) log.Error("Can't read PID file %s: %s", pidfile, err)
return return

View File

@ -136,6 +136,10 @@ func (t *TLSMod) Reload() {
t.certLastMod = fi.ModTime().UTC() t.certLastMod = fi.ModTime().UTC()
_ = reconfigureDNSServer() _ = reconfigureDNSServer()
t.confLock.Lock()
tlsConf = t.conf
t.confLock.Unlock()
Context.web.TLSConfigChanged(tlsConf) Context.web.TLSConfigChanged(tlsConf)
} }