Commit c043bd73 authored by Frank Denis's avatar Frank Denis

Ping the service manager early

Maybe
fixes #548

(untested)
parent daa10c92
......@@ -45,7 +45,7 @@ func main() {
dlog.Debug(err)
}
app.proxy = NewProxy()
_ = ServiceManagerStartNotify()
if err := ConfigLoad(&app.proxy, svcFlag); err != nil {
dlog.Fatal(err)
}
......
......@@ -38,7 +38,7 @@ func (proxy *Proxy) dropPrivilege(userStr string, fds []*os.File) {
dlog.Fatal(err)
}
SystemDNotify()
ServiceManagerReadyNotify()
args = args[1:]
args = append(args, "-child")
......
......@@ -154,7 +154,7 @@ func (proxy *Proxy) StartProxy() {
if liveServers > 0 {
dlog.Noticef("dnscrypt-proxy is ready - live servers: %d", liveServers)
if !proxy.child {
SystemDNotify()
ServiceManagerReadyNotify()
}
} else if err != nil {
dlog.Error(err)
......
package main
import "github.com/coreos/go-systemd/daemon"
func ServiceManagerStartNotify() error {
daemon.SdNotify(false, "STATUS=Starting")
return nil
}
func ServiceManagerReadyNotify() {
daemon.SdNotify(false, "READY=1")
}
// +build !linux,!windows
package main
func ServiceManagerStartNotify() error {
return nil
}
func ServiceManagerReadyNotify() {
}
package main
import "golang.org/x/sys/windows/svc/mgr"
func ServiceManagerStartNotify() error {
mgr, err := mgr.Connect()
if err != nil {
return err
}
mgr.Disconnect()
return nil
}
func ServiceManagerReadyNotify() {}
......@@ -5,5 +5,3 @@ package main
func (proxy *Proxy) SystemDListeners() error {
return nil
}
func SystemDNotify() {}
......@@ -4,7 +4,6 @@ import (
"net"
"github.com/coreos/go-systemd/activation"
"github.com/coreos/go-systemd/daemon"
"github.com/jedisct1/dlog"
)
......@@ -28,7 +27,3 @@ func (proxy *Proxy) SystemDListeners() error {
return nil
}
func SystemDNotify() {
daemon.SdNotify(false, "READY=1")
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment