From 6f1e01813a9a791e6496258bc27a905a2b8f6806 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 8 Nov 2016 23:15:52 +0000 Subject: [PATCH] Check desired state == started before allowing service to begin smooth recovery. --- src/service.cc | 2 +- src/service.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service.cc b/src/service.cc index 6185d35..d140fc4 100644 --- a/src/service.cc +++ b/src/service.cc @@ -198,7 +198,7 @@ void ServiceRecord::handle_exit_status() noexcept // we assume that the process died because we signalled it. stopped(); } - else if (smooth_recovery && service_state == ServiceState::STARTED) { + else if (smooth_recovery && service_state == ServiceState::STARTED && desired_state == ServiceState::STARTED) { // TODO ensure a minimum time between restarts // TODO if we are pinned-started then we should probably check // that dependencies have started before trying to re-start the diff --git a/src/service.h b/src/service.h index 605984f..6ff70bb 100644 --- a/src/service.h +++ b/src/service.h @@ -45,7 +45,7 @@ * ------------------ * Each service has a dependent-count ("required_by"). This starts at 0, adds 1 if the * service has explicitly been started (i.e. "start_explicit" is true), and adds 1 for - * each dependent service which is not STOPPED (including depdendents with a soft dependency). + * each dependent service which is not STOPPED (including dependents with a soft dependency). * When required_by transitions to 0, the service is stopped (unless it is pinned). When * require_by transitions from 0, the service is started (unless pinned). * -- 2.25.1