From: Davin McCall Date: Fri, 24 May 2019 11:49:41 +0000 (+1000) Subject: Rename/reverse set_auto_restart() to is_shutting_down(). X-Git-Tag: v0.6.0~56 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bb7db7f6e8af245d00b5020091b0c282df610047;p=oweals%2Fdinit.git Rename/reverse set_auto_restart() to is_shutting_down(). --- diff --git a/src/includes/service.h b/src/includes/service.h index c532d97..9f55f32 100644 --- a/src/includes/service.h +++ b/src/includes/service.h @@ -917,28 +917,16 @@ class service_set process_queues(); } - void set_auto_restart(bool restart) noexcept + bool is_shutting_down() noexcept { - restart_enabled = restart; + return !restart_enabled; } - - bool get_auto_restart() noexcept - { - return restart_enabled; - } - + shutdown_type_t get_shutdown_type() noexcept { return shutdown_type; } - // Set the shutdown type to the specified type, without issuing a shutdown order. If all services - // stop, the shutdown type determines the action that Dinit will take. - void set_shutdown_type(shutdown_type_t new_shutdown_type) noexcept - { - shutdown_type = new_shutdown_type; - } - // Get an identifier for the run-time type of the service set (similar to typeid, but without // requiring RTTI to be enabled during compilation). virtual int get_set_type_id() diff --git a/src/service.cc b/src/service.cc index 2fc07b3..40ab90b 100644 --- a/src/service.cc +++ b/src/service.cc @@ -71,7 +71,7 @@ void service_record::stopped() noexcept } bool will_restart = (desired_state == service_state_t::STARTED) - && services->get_auto_restart(); + && !services->is_shutting_down(); for (auto & dependency : depends_on) { // we signal dependencies in case they are waiting for us to stop: @@ -130,7 +130,7 @@ void service_record::stopped() noexcept bool service_record::do_auto_restart() noexcept { if (auto_restart) { - return services->get_auto_restart(); + return !services->is_shutting_down(); } return false; }