- // If we are a soft dependency of another target, break the acquisition from that target now:
- for (auto & dependent : dependents) {
- if (dependent->dep_type != dependency_type::REGULAR) {
- if (dependent->holding_acq) {
- dependent->holding_acq = false;
- release();
+ restarting |= auto_restart;
+ bool will_restart = restarting && required_by > 0;
+ if (restarting && ! will_restart) {
+ notify_listeners(service_event_t::STARTCANCELLED);
+ }
+ restarting = false;
+
+ // If we won't restart, break soft dependencies now
+ if (! will_restart) {
+ for (auto dept : dependents) {
+ if (! dept->is_hard()) {
+ // waits-for or soft dependency:
+ if (dept->waiting_on) {
+ dept->waiting_on = false;
+ dept->get_from()->dependency_started();
+ }
+ if (dept->holding_acq) {
+ dept->holding_acq = false;
+ // release without issuing stop, since we're called only when this
+ // service is already stopped/stopping:
+ release(false);
+ }