From 81839d2107186500613487ddf0ba0401e0485790 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 30 May 2017 11:10:23 +0100 Subject: [PATCH] Simplify allDepStarted logic. Change default action of start_ps_process to call started(). This is overriden in base_process_service to launch the process. --- src/service.cc | 15 +++++---------- src/service.h | 2 ++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/service.cc b/src/service.cc index 375d66b..e9a9577 100644 --- a/src/service.cc +++ b/src/service.cc @@ -636,16 +636,9 @@ void ServiceRecord::allDepsStarted(bool has_console) noexcept failed_to_start(); } - if (service_type == ServiceType::PROCESS || service_type == ServiceType::BGPROCESS - || service_type == ServiceType::SCRIPTED) { - bool start_success = start_ps_process(); - if (! start_success) { - failed_to_start(); - } - } - else { - // "internal" service - started(); + bool start_success = start_ps_process(); + if (! start_success) { + failed_to_start(); } } @@ -762,6 +755,8 @@ void ServiceRecord::failed_to_start(bool depfailed) noexcept bool ServiceRecord::start_ps_process() noexcept { + // default implementation: there is no process, so we are started. + started(); return true; } diff --git a/src/service.h b/src/service.h index 9468e4d..70b55af 100644 --- a/src/service.h +++ b/src/service.h @@ -583,6 +583,8 @@ class base_process_service : public ServiceRecord class process_service : public base_process_service { + // called when the process exits. The exit_status is the status value yielded by + // the "wait" system call. virtual void handle_exit_status(int exit_status) noexcept override; public: -- 2.25.1