bool stop_dependents() noexcept;
void require() noexcept;
- void release() noexcept;
+ void release(bool issue_stop = true) noexcept;
void release_dependencies() noexcept;
// Check if service is, fundamentally, stopped.
{
if (! do_auto_restart() && start_explicit) {
start_explicit = false;
- release();
+ release(false);
}
forced_stop();
stop_dependents();
}
}
-void service_record::release() noexcept
+void service_record::release(bool issue_stop) noexcept
{
if (--required_by == 0) {
desired_state = service_state_t::STOPPED;
if (service_state == service_state_t::STOPPED) {
services->service_inactive(this);
}
- else {
+ else if (issue_stop) {
do_stop();
}
}
service_state = service_state_t::STOPPED;
if (start_explicit) {
start_explicit = false;
- release();
+ release(false);
}
notify_listeners(service_event_t::FAILEDSTART);
if (start_explicit && ! do_auto_restart()) {
start_explicit = false;
- release();
- if (required_by == 0) return; // release will re-call us anyway
+ release(false);
}
bool all_deps_stopped = stop_dependents();