Skip to content

Commit 77059ce

Browse files
authored
systemd: report Ready earlier as dnscrypt-proxy can itself manage retries for updates/refreshes (#2225)
1 parent 09a6918 commit 77059ce

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

dnscrypt-proxy/proxy.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ func (proxy *Proxy) StartProxy() {
233233
}
234234
curve25519.ScalarBaseMult(&proxy.proxyPublicKey, &proxy.proxySecretKey)
235235
proxy.startAcceptingClients()
236+
if !proxy.child {
237+
// Notify systemd that dnscrypt-proxy is ready. dnscrypt-proxy manages itself in case
238+
// servers are not immediately live/reachable. Systemd may assume it is initialized and
239+
// functioning properly. Note that the systemd notify 'Ready' signal is delayed if netprobe
240+
// cannot reach the internet during start-up.
241+
if err := ServiceManagerReadyNotify(); err != nil {
242+
dlog.Fatal(err)
243+
}
244+
}
236245
liveServers, err := proxy.serversInfo.refresh(proxy)
237246
if liveServers > 0 {
238247
proxy.certIgnoreTimestamp = false
@@ -242,11 +251,6 @@ func (proxy *Proxy) StartProxy() {
242251
}
243252
if liveServers > 0 {
244253
dlog.Noticef("dnscrypt-proxy is ready - live servers: %d", liveServers)
245-
if !proxy.child {
246-
if err := ServiceManagerReadyNotify(); err != nil {
247-
dlog.Fatal(err)
248-
}
249-
}
250254
} else if err != nil {
251255
dlog.Error(err)
252256
dlog.Notice("dnscrypt-proxy is waiting for at least one server to be reachable")

0 commit comments

Comments
 (0)