Fix restart of dependency services not explicitly started.
authorDavin McCall <davmac@davmac.org>
Tue, 28 May 2019 10:11:48 +0000 (20:11 +1000)
committerDavin McCall <davmac@davmac.org>
Tue, 28 May 2019 10:11:48 +0000 (20:11 +1000)
src/service.cc

index 504a9b6de0836710449785effbac4a3f04b97452..8f4ce2ccccab310e7556a0334b04d48396b8ff02 100644 (file)
@@ -59,17 +59,6 @@ void service_record::stopped() noexcept
 
     force_stop = false;
 
-    // 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  && ! dependent->waiting_on) {
-                dependent->holding_acq = false;
-                release();
-            }
-        }
-    }
-
     bool will_restart = (desired_state == service_state_t::STARTED)
             && !services->is_shutting_down();
 
@@ -581,7 +570,7 @@ bool service_record::stop_dependents() noexcept
                 dept->waiting_on = false;
                 dept->get_from()->dependency_started();
             }
-            if (dept->holding_acq) {
+            if (dept->holding_acq && !auto_restart) {
                 dept->holding_acq = false;
                 // release without issuing stop, since we should be called only when this
                 // service is already stopped/stopping: