File tree Expand file tree Collapse file tree 4 files changed +29
-14
lines changed
Expand file tree Collapse file tree 4 files changed +29
-14
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
184184 }, logrus .StandardLogger ())
185185
186186 // Notify that the API is active, but before daemon is set up.
187- preNotifySystem ()
187+ preNotifyReady ()
188188
189189 pluginStore := plugin .NewStore ()
190190
@@ -242,13 +242,15 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
242242 go cli .api .Wait (serveAPIWait )
243243
244244 // after the daemon is done setting up we can notify systemd api
245- notifySystem ()
245+ notifyReady ()
246246
247247 // Daemon is fully initialized and handling API traffic
248248 // Wait for serve API to complete
249249 errAPI := <- serveAPIWait
250250 c .Cleanup ()
251251
252+ // notify systemd that we're shutting down
253+ notifyStopping ()
252254 shutdownDaemon (d )
253255
254256 // Stop notification processing and any background processes
Original file line number Diff line number Diff line change 11package main
22
3- // preNotifySystem sends a message to the host when the API is active, but before the daemon is
4- func preNotifySystem () {
3+ // preNotifyReady sends a message to the host when the API is active, but before the daemon is
4+ func preNotifyReady () {
55}
66
7- // notifySystem sends a message to the host when the server is ready to be used
8- func notifySystem () {
7+ // notifyReady sends a message to the host when the server is ready to be used
8+ func notifyReady () {
9+ }
10+
11+ // notifyStopping sends a message to the host when the server is shutting down
12+ func notifyStopping () {
913}
Original file line number Diff line number Diff line change @@ -2,12 +2,17 @@ package main
22
33import systemdDaemon "github.com/coreos/go-systemd/v22/daemon"
44
5- // preNotifySystem sends a message to the host when the API is active, but before the daemon is
6- func preNotifySystem () {
5+ // preNotifyReady sends a message to the host when the API is active, but before the daemon is
6+ func preNotifyReady () {
77}
88
9- // notifySystem sends a message to the host when the server is ready to be used
10- func notifySystem () {
9+ // notifyReady sends a message to the host when the server is ready to be used
10+ func notifyReady () {
1111 // Tell the init daemon we are accepting requests
1212 go systemdDaemon .SdNotify (false , systemdDaemon .SdNotifyReady )
1313}
14+
15+ // notifyStopping sends a message to the host when the server is shutting down
16+ func notifyStopping () {
17+ go systemdDaemon .SdNotify (false , systemdDaemon .SdNotifyStopping )
18+ }
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ func getDaemonConfDir(root string) (string, error) {
2727 return filepath .Join (root , `\config` ), nil
2828}
2929
30- // preNotifySystem sends a message to the host when the API is active, but before the daemon is
31- func preNotifySystem () {
30+ // preNotifyReady sends a message to the host when the API is active, but before the daemon is
31+ func preNotifyReady () {
3232 // start the service now to prevent timeouts waiting for daemon to start
3333 // but still (eventually) complete all requests that are sent after this
3434 if service != nil {
@@ -39,8 +39,12 @@ func preNotifySystem() {
3939 }
4040}
4141
42- // notifySystem sends a message to the host when the server is ready to be used
43- func notifySystem () {
42+ // notifyReady sends a message to the host when the server is ready to be used
43+ func notifyReady () {
44+ }
45+
46+ // notifyStopping sends a message to the host when the server is shutting down
47+ func notifyStopping () {
4448}
4549
4650// notifyShutdown is called after the daemon shuts down but before the process exits.
You can’t perform that action at this time.
0 commit comments