Remove activated state if a service stops naturally
authorDavin McCall <davmac@davmac.org>
Fri, 24 Jun 2016 15:30:27 +0000 (16:30 +0100)
committerDavin McCall <davmac@davmac.org>
Fri, 24 Jun 2016 15:30:27 +0000 (16:30 +0100)
(if auto-restart is enabled, it will restart instead).

src/service.cc

index 566bd0531b28070568c1a0e65ee5353ad1c3cdd2..5425a21f99a7229575678292f9e7c4fde8928c92 100644 (file)
@@ -91,11 +91,18 @@ void ServiceRecord::stopped() noexcept
         service_set->addToStartQueue(this);
     }
     else {
+        desired_state = ServiceState::STOPPED;
+        
         if (socket_fd != -1) {
             close(socket_fd);
             socket_fd = -1;
         }
         
+        if (start_explicit) {
+            start_explicit = false;
+            required_by--;
+        }
+        
         if (required_by == 0) {
             // Service is now completely inactive.
             release_dependencies();