systemd: report Ready earlier as dnscrypt-proxy can itself manage retries for updates/refreshes (#2225)

This commit is contained in:
cobratbq 2022-10-20 13:32:26 +00:00 committed by GitHub
parent 09a6918226
commit 77059ce450
Failed to generate hash of commit

View file

@ -233,6 +233,15 @@ func (proxy *Proxy) StartProxy() {
}
curve25519.ScalarBaseMult(&proxy.proxyPublicKey, &proxy.proxySecretKey)
proxy.startAcceptingClients()
if !proxy.child {
// Notify systemd that dnscrypt-proxy is ready. dnscrypt-proxy manages itself in case
// servers are not immediately live/reachable. Systemd may assume it is initialized and
// functioning properly. Note that the systemd notify 'Ready' signal is delayed if netprobe
// cannot reach the internet during start-up.
if err := ServiceManagerReadyNotify(); err != nil {
dlog.Fatal(err)
}
}
liveServers, err := proxy.serversInfo.refresh(proxy)
if liveServers > 0 {
proxy.certIgnoreTimestamp = false
@ -242,11 +251,6 @@ func (proxy *Proxy) StartProxy() {
}
if liveServers > 0 {
dlog.Noticef("dnscrypt-proxy is ready - live servers: %d", liveServers)
if !proxy.child {
if err := ServiceManagerReadyNotify(); err != nil {
dlog.Fatal(err)
}
}
} else if err != nil {
dlog.Error(err)
dlog.Notice("dnscrypt-proxy is waiting for at least one server to be reachable")