Check desired state == started before allowing service to begin
authorDavin McCall <davmac@davmac.org>
Tue, 8 Nov 2016 23:15:52 +0000 (23:15 +0000)
committerDavin McCall <davmac@davmac.org>
Tue, 8 Nov 2016 23:15:52 +0000 (23:15 +0000)
smooth recovery.

src/service.cc
src/service.h

index 6185d355ce68b9549298bd0d6f5bfe78ca6c359e..d140fc4f19aa0f04995d2afc05aece6ec459e83d 100644 (file)
@@ -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
index 605984f37f415fec4f6800b89001263e8b1a3b45..6ff70bbc7a35bbf3c675e29ec4e57f7ac09e0d5f 100644 (file)
@@ -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).
  *