One, release the service if it was explicitly started (which will
bring it down only if it is no longer needed by any active service)
Two, release the service and bring it down (which will also bring
down any dependent services).
}
}
-void ServiceRecord::stop() noexcept
+void ServiceRecord::stop(bool bring_down) noexcept
{
- if (desired_state == ServiceState::STOPPED && service_state != ServiceState::STARTED) return;
-
- desired_state = ServiceState::STOPPED;
-
if (start_explicit) {
start_explicit = false;
release();
}
+
+ if (bring_down) {
+ desired_state = ServiceState::STOPPED;
+ do_stop();
+ }
}
void ServiceRecord::do_stop() noexcept
ServiceState getState() const noexcept { return service_state; }
void start(bool activate = true) noexcept; // start the service
- void stop() noexcept; // stop the service
+ void stop(bool bring_down = true) noexcept; // stop the service
void forceStop() noexcept; // force-stop this service and all dependents