A forced stop at the point of reaching STARTED state should not
authorDavin McCall <davmac@davmac.org>
Sun, 3 Jan 2016 16:16:21 +0000 (16:16 +0000)
committerDavin McCall <davmac@davmac.org>
Sun, 3 Jan 2016 16:16:21 +0000 (16:16 +0000)
actually change the desired state: call start() after stop() if
the desired state is not STOPPED.

service.cc

index a3a01eb1261b0837da3854115440c1a04a7b1e70..06ec5ada7084f380008368d5f0ba18d5c36367bf 100644 (file)
@@ -416,7 +416,11 @@ void ServiceRecord::started() noexcept
 
     if (force_stop || desired_state == ServiceState::STOPPED) {
         // We must now stop.
+        bool do_restart = (desired_state != ServiceState::STOPPED);
         stop();
+        if (do_restart) {
+            start();
+        }
         return;
     }