chiark / gitweb /
core: don't warn loudly if we cannot send a bus signal to a disconnected client
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Nov 2013 19:19:27 +0000 (20:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Nov 2013 19:19:27 +0000 (20:19 +0100)
src/core/dbus-job.c
src/core/dbus-manager.c
src/core/dbus-manager.h
src/core/dbus-unit.c

index 923d545..8c12b52 100644 (file)
@@ -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));
 }
index 9ecf14c..b934624 100644 (file)
@@ -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));
+
 }
index ad451eb..0ef99fa 100644 (file)
@@ -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);
index 975fc46..3c25c36 100644 (file)
@@ -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(