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
*/
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);
}