Adjust dependency auto-break logic.
authorDavin McCall <davmac@davmac.org>
Thu, 13 Sep 2018 15:33:34 +0000 (16:33 +0100)
committerDavin McCall <davmac@davmac.org>
Thu, 13 Sep 2018 15:35:32 +0000 (16:35 +0100)
If a service stops, and has a soft dependency from another service,
don't break the dependency if the service is waiting_on this one - in
that case we want to restart.

src/service.cc

index fe7f9dc478c28a3f6af36e45bc47066485ad73ce..2ae19150f8b04e8770ce0703395a30827ca264b2 100644 (file)
@@ -60,10 +60,11 @@ void service_record::stopped() noexcept
 
     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();
             }