cmd/cli: write new config file on reload

This commit is contained in:
Cuong Manh Le
2024-07-29 23:05:49 +07:00
committed by Cuong Manh Le
parent 12d6484b1c
commit c233ad9b1b
7 changed files with 20 additions and 11 deletions
+2 -1
View File
@@ -93,6 +93,7 @@ func (p *prog) serveDNS(listenerNum string) error {
_ = w.WriteMsg(answer)
return
}
listenerConfig := p.cfg.Listener[listenerNum]
reqId := requestID()
ctx := context.WithValue(context.Background(), ctrld.ReqIdCtxKey{}, reqId)
if !listenerConfig.AllowWanClients && isWanClient(w.RemoteAddr()) {
@@ -847,7 +848,7 @@ func (p *prog) spoofLoopbackIpInClientInfo(ci *ctrld.ClientInfo) {
// - Number of refused queries seen so far equals to selfUninstallMaxQueries.
// - The cdUID is deleted.
func (p *prog) doSelfUninstall(answer *dns.Msg) {
if !p.canSelfUninstall || answer == nil || answer.Rcode != dns.RcodeRefused {
if !p.canSelfUninstall.Load() || answer == nil || answer.Rcode != dns.RcodeRefused {
return
}