summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-22 20:19:27 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-22 20:19:27 +0100
commit39abcaee3e905f41efcb8b11ff4ff013f552620c (patch)
tree9ea9c6089d8ac4092ce4c02120874d267a47a012
parentdbc2c080debdc45683bc5534e327455d4fbbbea7 (diff)
core: don't warn loudly if we cannot send a bus signal to a disconnected client
-rw-r--r--src/core/dbus-job.c20
-rw-r--r--src/core/dbus-manager.c34
-rw-r--r--src/core/dbus-manager.h4
-rw-r--r--src/core/dbus-unit.c6
4 files changed, 40 insertions, 24 deletions
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 923d545a02..8c12b52b64 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -84,7 +84,7 @@ static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
Iterator i;
sd_bus *b;
unsigned n, m;
- int r;
+ int r, ret;
assert(j);
assert(send_message);
@@ -105,17 +105,22 @@ static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
if (one_destination)
return send_message(one_destination->bus, isempty(one_destination->name) ? NULL : one_destination->name, j);
+ ret = 0;
+
/* Send to everybody */
SET_FOREACH(b, j->manager->private_buses, i) {
r = send_message(b, NULL, j);
if (r < 0)
- return r;
+ ret = r;
}
- if (j->manager->api_bus)
- return send_message(j->manager->api_bus, NULL, j);
+ if (j->manager->api_bus) {
+ r = send_message(j->manager->api_bus, NULL, j);
+ if (r < 0)
+ ret = r;
+ }
- return 0;
+ return ret;
}
static int send_new_signal(sd_bus *bus, const char *destination, Job *j) {
@@ -171,7 +176,7 @@ void bus_job_send_change_signal(Job *j) {
r = foreach_client(j, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal);
if (r < 0)
- log_warning("Failed to send job change signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
+ log_debug("Failed to send job change signal for %u: %s", j->id, strerror(-r));
j->sent_dbus_new_signal = true;
}
@@ -215,6 +220,5 @@ void bus_job_send_removed_signal(Job *j) {
r = foreach_client(j, send_removed_signal);
if (r < 0)
- log_warning("Failed to send job removal signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
- return;
+ log_debug("Failed to send job remove signal for %u: %s", j->id, strerror(-r));
}
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 9ecf14c235..b934624def 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1624,7 +1624,7 @@ int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, cons
Iterator i;
sd_bus *b;
unsigned n;
- int r;
+ int r, ret;
n = set_size(m->subscribed);
if (n <= 0)
@@ -1636,17 +1636,22 @@ int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, cons
return send_message(d->bus, isempty(d->name) ? NULL : d->name, userdata);
}
+ ret = 0;
+
/* Send to everybody */
SET_FOREACH(b, m->private_buses, i) {
r = send_message(b, NULL, userdata);
if (r < 0)
- return r;
+ ret = r;
}
- if (m->api_bus)
- return send_message(m->api_bus, NULL, userdata);
+ if (m->api_bus) {
+ r = send_message(m->api_bus, NULL, userdata);
+ if (r < 0)
+ ret = r;
+ }
- return 0;
+ return ret;
}
static int send_finished(sd_bus *bus, const char *destination, void *userdata) {
@@ -1668,7 +1673,7 @@ static int send_finished(sd_bus *bus, const char *destination, void *userdata) {
return sd_bus_send_to(bus, message, destination, NULL);
}
-int bus_manager_send_finished(
+void bus_manager_send_finished(
Manager *m,
usec_t firmware_usec,
usec_t loader_usec,
@@ -1677,10 +1682,14 @@ int bus_manager_send_finished(
usec_t userspace_usec,
usec_t total_usec) {
+ int r;
+
assert(m);
- return bus_manager_foreach_client(m, send_finished,
- (usec_t[6]) { firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec });
+ r = bus_manager_foreach_client(m, send_finished,
+ (usec_t[6]) { firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec });
+ if (r < 0)
+ log_debug("Failed to send finished signal: %s", strerror(-r));
}
static int send_reloading(sd_bus *bus, const char *destination, void *userdata) {
@@ -1700,8 +1709,13 @@ static int send_reloading(sd_bus *bus, const char *destination, void *userdata)
return sd_bus_send_to(bus, message, destination, NULL);
}
-int bus_manager_send_reloading(Manager *m, bool active) {
+void bus_manager_send_reloading(Manager *m, bool active) {
+ int r;
+
assert(m);
- return bus_manager_foreach_client(m, send_reloading, INT_TO_PTR(active));
+ r = bus_manager_foreach_client(m, send_reloading, INT_TO_PTR(active));
+ if (r < 0)
+ log_debug("Failed to send reloading signal: %s", strerror(-r));
+
}
diff --git a/src/core/dbus-manager.h b/src/core/dbus-manager.h
index ad451eb6fd..0ef99fad41 100644
--- a/src/core/dbus-manager.h
+++ b/src/core/dbus-manager.h
@@ -28,5 +28,5 @@ extern const sd_bus_vtable bus_manager_vtable[];
int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, const char *destination, void *userdata), void *userdata);
-int bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
-int bus_manager_send_reloading(Manager *m, bool active);
+void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
+void bus_manager_send_reloading(Manager *m, bool active);
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 975fc46289..3c25c36729 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -664,7 +664,6 @@ static int send_changed_signal(sd_bus *bus, const char *destination, void *userd
void bus_unit_send_change_signal(Unit *u) {
int r;
-
assert(u);
if (u->in_dbus_queue) {
@@ -677,7 +676,7 @@ void bus_unit_send_change_signal(Unit *u) {
r = bus_manager_foreach_client(u->manager, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u);
if (r < 0)
- log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+ log_debug("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
u->sent_dbus_new_signal = true;
}
@@ -713,7 +712,6 @@ static int send_removed_signal(sd_bus *bus, const char *destination, void *userd
void bus_unit_send_removed_signal(Unit *u) {
int r;
-
assert(u);
if (!u->sent_dbus_new_signal)
@@ -724,7 +722,7 @@ void bus_unit_send_removed_signal(Unit *u) {
r = bus_manager_foreach_client(u->manager, send_removed_signal, u);
if (r < 0)
- log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+ log_debug("Failed to send unit remove signal for %s: %s", u->id, strerror(-r));
}
int bus_unit_queue_job(