From e18f8852f37f1156c006e5907e099f89b4c67b29 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 29 Nov 2018 16:34:59 +0100 Subject: [PATCH] core: invalidate invidual Assert/Condition properties when sending out change messages Let's inform the clients about assert/condition property changes as they happen, it's basically for free because assert/condition property changes generally coincide with other unit state changes (after all these checks are done on unit_start()) --- src/core/dbus-unit.c | 4 ++-- src/core/unit.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 5665bf97a84..f398dabc8d7 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -662,8 +662,8 @@ const sd_bus_vtable bus_unit_vtable[] = { SD_BUS_PROPERTY("AssertResult", "b", bus_property_get_bool, offsetof(Unit, assert_result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_PROPERTY_DUAL_TIMESTAMP("ConditionTimestamp", offsetof(Unit, condition_timestamp), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_PROPERTY_DUAL_TIMESTAMP("AssertTimestamp", offsetof(Unit, assert_timestamp), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), - SD_BUS_PROPERTY("Conditions", "a(sbbsi)", property_get_conditions, offsetof(Unit, conditions), 0), - SD_BUS_PROPERTY("Asserts", "a(sbbsi)", property_get_conditions, offsetof(Unit, asserts), 0), + SD_BUS_PROPERTY("Conditions", "a(sbbsi)", property_get_conditions, offsetof(Unit, conditions), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), + SD_BUS_PROPERTY("Asserts", "a(sbbsi)", property_get_conditions, offsetof(Unit, asserts), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), SD_BUS_PROPERTY("LoadError", "(ss)", property_get_load_error, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Transient", "b", bus_property_get_bool, offsetof(Unit, transient), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Perpetual", "b", bus_property_get_bool, offsetof(Unit, perpetual), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/unit.c b/src/core/unit.c index cc4ae505161..175c56f48ab 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1637,6 +1637,8 @@ static bool unit_condition_test(Unit *u) { dual_timestamp_get(&u->condition_timestamp); u->condition_result = unit_condition_test_list(u, u->conditions, condition_type_to_string); + unit_add_to_dbus_queue(u); + return u->condition_result; } @@ -1646,6 +1648,8 @@ static bool unit_assert_test(Unit *u) { dual_timestamp_get(&u->assert_timestamp); u->assert_result = unit_condition_test_list(u, u->asserts, assert_type_to_string); + unit_add_to_dbus_queue(u); + return u->assert_result; } -- 2.47.3