summaryrefslogtreecommitdiff
path: root/src/core/scope.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-27 20:15:45 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-01 12:53:26 +0100
commit6fcbec6f9b15e534badd069610e35f4c5303c502 (patch)
tree22505234e50866f760c672e4913e250da8cea3b2 /src/core/scope.c
parent37d0b962eff19234d0b485c14b007081d2067ab9 (diff)
downloadsystemd-6fcbec6f9b15e534badd069610e35f4c5303c502.tar.gz
core: whenever we change state of a unit, force out PropertiesChanged bus signal
This allows clients to follow our internal state changes safely. Previously, quick state changes (for example, when we restart a unit due to Restart= after it quickly transitioned through DEAD/FAILED states) would be coalesced into one bus signal event, with this change there's the guarantee that all state changes after the unit was announced ones are reflected on th bus. Note we only do this kind of guaranteed flushing only for unit state changes, not for other unit property changes, where clients still have to expect coalescing. This is because the unit state is a very important, high-level concept. Fixes: #10185
Diffstat (limited to 'src/core/scope.c')
-rw-r--r--src/core/scope.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/scope.c b/src/core/scope.c
index 151b8989a6..e478661f94 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "dbus-scope.h"
+#include "dbus-unit.h"
#include "load-dropin.h"
#include "log.h"
#include "scope.h"
@@ -82,6 +83,9 @@ static void scope_set_state(Scope *s, ScopeState state) {
ScopeState old_state;
assert(s);
+ if (s->state != state)
+ bus_unit_send_pending_change_signal(UNIT(s), false);
+
old_state = s->state;
s->state = state;