{
using std::list;
list<service_record *>::const_iterator i = records.begin();
- for ( ; i != records.end(); i++ ) {
+ for ( ; i != records.end(); ++i ) {
if (strcmp((*i)->get_name().c_str(), name) == 0) {
return *i;
}
force_stop = false;
- // If we are a soft dependency of another target, break the acquisition from that target now:
+ // If we are a soft dependency of another target, break the acquisition from that target now,
+ // so that we don't re-start:
for (auto & dependent : dependents) {
if (dependent->dep_type != dependency_type::REGULAR) {
- if (dependent->holding_acq) {
+ if (dependent->holding_acq && ! dependent->waiting_on) {
dependent->holding_acq = false;
release();
}
services->service_inactive(this);
}
else if (issue_stop) {
+ stop_reason = stopped_reason_t::NORMAL;
do_stop();
}
}
if (prop_failure) {
prop_failure = false;
+ stop_reason = stopped_reason_t::DEPFAILED;
failed_to_start(true);
}
release();
}
- if (bring_down) {
+ if (bring_down && service_state != service_state_t::STOPPED
+ && service_state != service_state_t::STOPPING) {
+ stop_reason = stopped_reason_t::NORMAL;
do_stop();
}
}
// we need to delegate to can_interrupt_start() (which can be overridden).
if (! waiting_for_deps && ! waiting_for_console) {
if (! can_interrupt_start()) {
- // Well this is awkward: we're going to have to continue starting. We can stop once we've
- // reached the started state.
+ // Well this is awkward: we're going to have to continue starting. We can stop once
+ // we've reached the started state.
return;
}
}
if (dept->holding_acq) {
dept->holding_acq = false;
- release();
+ // release without issuing stop, since we should be called only when this
+ // service is already stopped/stopping:
+ release(false);
}
}
}