1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-28 02:50:16 +03:00

core: always consider clients that pinned a unit to be subscribers

If a client pins a unit, then it makes sense to also implicitly make it
a subscriber. This is useful for clients that just want to watch one
specific unit: they can pin it and receive its messages.
This commit is contained in:
Lennart Poettering 2017-02-28 17:55:57 +01:00
parent 5e806f453d
commit ae572acd62
2 changed files with 3 additions and 2 deletions

View File

@ -1131,7 +1131,7 @@ void bus_unit_send_change_signal(Unit *u) {
if (!u->id)
return;
r = bus_foreach_bus(u->manager, NULL, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u);
r = bus_foreach_bus(u->manager, u->bus_track, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u);
if (r < 0)
log_unit_debug_errno(u, r, "Failed to send unit change signal for %s: %m", u->id);
@ -1177,7 +1177,7 @@ void bus_unit_send_removed_signal(Unit *u) {
if (!u->id)
return;
r = bus_foreach_bus(u->manager, NULL, send_removed_signal, u);
r = bus_foreach_bus(u->manager, u->bus_track, send_removed_signal, u);
if (r < 0)
log_unit_debug_errno(u, r, "Failed to send unit remove signal for %s: %m", u->id);
}

View File

@ -402,6 +402,7 @@ void unit_add_to_dbus_queue(Unit *u) {
/* Shortcut things if nobody cares */
if (sd_bus_track_count(u->manager->subscribed) <= 0 &&
sd_bus_track_count(u->bus_track) <= 0 &&
set_isempty(u->manager->private_buses)) {
u->sent_dbus_new_signal = true;
return;