]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: log closing cmd socket and STOPPED state 2042/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 16 Dec 2017 13:39:12 +0000 (14:39 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 21 Dec 2017 22:01:04 +0000 (23:01 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 5327e44b25f283deefcc0db05b859cfe38c66dd8..83991cf5338086471e320d717d2e50b11caa3ca2 100644 (file)
@@ -784,11 +784,6 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
 
        cgroup_destroy(handler);
 
-       /* This function will try to connect to the legacy lxc-monitord state
-        * server and only exists for backwards compatibility.
-        */
-       lxc_monitor_send_state(name, STOPPED, handler->lxcpath);
-
        if (handler->conf->reboot == 0) {
                /* For all new state clients simply close the command socket.
                 * This will inform all state clients that the container is
@@ -798,6 +793,18 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
                 */
                close(handler->conf->maincmd_fd);
                handler->conf->maincmd_fd = -1;
+               TRACE("Closed command socket");
+
+               /* This function will try to connect to the legacy lxc-monitord
+                * state server and only exists for backwards compatibility.
+                */
+               lxc_monitor_send_state(name, STOPPED, handler->lxcpath);
+
+               /* The command socket is closed so no one can acces the command
+                * socket anymore so there's no need to lock it.
+                */
+               handler->state = STOPPED;
+               TRACE("Set container state to \"STOPPED\"");
        } else {
                lxc_set_state(name, handler, STOPPED);
        }