chiark / gitweb /
dbus-timer: fix bus_timer_vtable to have the correct times
[elogind.git] / src / core / dbus-job.c
index 923d545..a8eae47 100644 (file)
@@ -72,9 +72,9 @@ static int method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, s
 const sd_bus_vtable bus_job_vtable[] = {
         SD_BUS_VTABLE_START(0),
         SD_BUS_METHOD("Cancel", NULL, NULL, method_cancel, 0),
-        SD_BUS_PROPERTY("Id", "u", NULL, offsetof(Job, id), 0),
-        SD_BUS_PROPERTY("Unit", "(so)", property_get_unit, 0, 0),
-        SD_BUS_PROPERTY("JobType", "s", property_get_type, offsetof(Job, type), 0),
+        SD_BUS_PROPERTY("Id", "u", NULL, offsetof(Job, id), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("Unit", "(so)", property_get_unit, 0, SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("JobType", "s", property_get_type, offsetof(Job, type), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("State", "s", property_get_state, offsetof(Job, state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_VTABLE_END
 };
@@ -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) {
@@ -132,10 +137,10 @@ static int send_new_signal(sd_bus *bus, const char *destination, Job *j) {
 
         r = sd_bus_message_new_signal(
                         bus,
+                        &m,
                         "/org/freedesktop/systemd1",
                         "org.freedesktop.systemd1.Manager",
-                        "JobNew",
-                        &m);
+                        "JobNew");
         if (r < 0)
                 return r;
 
@@ -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;
 }
@@ -191,10 +196,10 @@ static int send_removed_signal(sd_bus *bus, const char *destination, Job *j) {
 
         r = sd_bus_message_new_signal(
                         bus,
+                        &m,
                         "/org/freedesktop/systemd1",
                         "org.freedesktop.systemd1.Manager",
-                        "JobRemoved",
-                        &m);
+                        "JobRemoved");
         if (r < 0)
                 return r;
 
@@ -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));
 }