summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-21 23:01:59 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-22 00:12:37 +0100
commit29f6aadd5302320d5a7a3868b607eb83687bdfd0 (patch)
tree441b4301dd4705d932cce9c41c36a2d0cdef4bdc
parent9a8ae49d91ae303c4f7c87f9c56fba3e8d646af7 (diff)
bus: implicitly set no_reply flag on outgoing messages if the serial number is not kept
If nobody keeps the serial number of an outgoing message we know that nobody expects an answer to it, so set the no_reply flag accordingly.
-rw-r--r--src/libsystemd-bus/sd-bus.c5
-rw-r--r--src/libsystemd-bus/sd-bus.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index d0a36081bc..ad840cc875 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1057,6 +1057,11 @@ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
if (!m)
return -EINVAL;
+ /* If the serial number isn't kept, then we know that no reply
+ * is expected */
+ if (!serial && !m->sealed)
+ m->header->flags |= SD_BUS_MESSAGE_NO_REPLY_EXPECTED;
+
r = bus_seal_message(bus, m);
if (r < 0)
return r;
diff --git a/src/libsystemd-bus/sd-bus.h b/src/libsystemd-bus/sd-bus.h
index ce92ee7df6..a759f54f3e 100644
--- a/src/libsystemd-bus/sd-bus.h
+++ b/src/libsystemd-bus/sd-bus.h
@@ -33,7 +33,6 @@
* - add page donation logic
* - api for appending/reading fixed arrays
* - always verify container depth
- * - implicitly set no_reply when a message-call is sent an the serial number ignored
* - handle NULL strings nicer when appending
* - merge busctl into systemctl or so?
* - add object handlers