From bb7db7f6e8af245d00b5020091b0c282df610047 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 24 May 2019 21:49:41 +1000 Subject: [PATCH] Rename/reverse set_auto_restart() to is_shutting_down(). --- src/includes/service.h | 18 +++--------------- src/service.cc | 4 ++-- 2 files changed, 5 insertions(+), 17 deletions(-) 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; } -- 2.25.1