In particular, failure to start did not always cause a release as it
should have.
else if (required_by == 0) {
// This can only be the case if we didn't have start_explicit, since required_by would
// otherwise by non-zero.
else if (required_by == 0) {
// This can only be the case if we didn't have start_explicit, since required_by would
// otherwise by non-zero.
+ prop_release = !prop_require;
+ prop_require = false;
+ services->add_prop_queue(this);
services->service_inactive(this);
}
}
services->service_inactive(this);
}
}
void service_record::failed_to_start(bool depfailed, bool immediate_stop) noexcept
{
void service_record::failed_to_start(bool depfailed, bool immediate_stop) noexcept
{
- if (immediate_stop) {
- service_state = service_state_t::STOPPED;
- if (have_console) {
- bp_sys::tcsetpgrp(0, bp_sys::getpgrp());
- release_console();
- }
- }
-
if (waiting_for_console) {
services->unqueue_console(this);
waiting_for_console = false;
}
if (waiting_for_console) {
services->unqueue_console(this);
waiting_for_console = false;
}
if (start_explicit) {
start_explicit = false;
release(false);
}
if (start_explicit) {
start_explicit = false;
release(false);
}
// Cancel start of dependents:
for (auto & dept : dependents) {
switch (dept->dep_type) {
// Cancel start of dependents:
for (auto & dept : dependents) {
switch (dept->dep_type) {
dept->waiting_on = false;
dept->get_from()->dependency_started();
}
dept->waiting_on = false;
dept->get_from()->dependency_started();
}
- if (dept->holding_acq) {
- dept->holding_acq = false;
- release();
- }
+ }
+
+ // Always release now, so that our desired state will be STOPPED before we call
+ // stopped() below (if we do so). Otherwise it may decide to restart us.
+ if (dept->holding_acq) {
+ dept->holding_acq = false;
+ release(false);
}
}
log_service_failed(get_name());
notify_listeners(service_event_t::FAILEDSTART);
}
}
log_service_failed(get_name());
notify_listeners(service_event_t::FAILEDSTART);
+
+ if (immediate_stop) {
+ stopped();
+ }
}
bool service_record::bring_up() noexcept
}
bool service_record::bring_up() noexcept