}
else if (setting == "waits-for") {
string dependency_name = read_setting_value(i, end);
- depends.emplace_back(load_service(dependency_name.c_str()), dependency_type::SOFT);
+ depends.emplace_back(load_service(dependency_name.c_str()), dependency_type::WAITS_FOR);
}
else if (setting == "logfile") {
logfile = read_setting_value(i, end);
// 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::SOFT) {
+ if (dependent->dep_type != dependency_type::REGULAR) {
if (dependent->holding_acq) {
dependent->holding_acq = false;
release();
// Cancel start of dependents:
for (auto & dept : dependents) {
- if (dept->dep_type == dependency_type::REGULAR) {
+ switch (dept->dep_type) {
+ case dependency_type::REGULAR:
+ case dependency_type::MILESTONE:
if (dept->get_from()->service_state == service_state_t::STARTING) {
dept->get_from()->prop_failure = true;
services->add_prop_queue(dept->get_from());
}
- }
- else if (dept->dep_type == dependency_type::SOFT) {
+ break;
+ case dependency_type::WAITS_FOR:
+ case dependency_type::SOFT:
if (dept->waiting_on) {
dept->waiting_on = false;
dept->get_from()->dependencyStarted();
#include "test_service.h"
constexpr static auto REG = dependency_type::REGULAR;
-constexpr static auto SFT = dependency_type::SOFT;
+constexpr static auto WAITS = dependency_type::WAITS_FOR;
// Test 1: starting a service starts dependencies; stopping the service releases and
// stops dependencies.
service_record *s1 = new service_record(&sset, "test-service-1", service_type::INTERNAL, {});
service_record *s2 = new service_record(&sset, "test-service-2", service_type::INTERNAL, {{s1, REG}});
- service_record *s3 = new service_record(&sset, "test-service-3", service_type::INTERNAL, {{s2, SFT}});
+ service_record *s3 = new service_record(&sset, "test-service-3", service_type::INTERNAL, {{s2, WAITS}});
sset.add_service(s1);
sset.add_service(s2);
sset.add_service(s3);