chiark / gitweb /
bus: implicitly set no_reply flag on outgoing messages if the serial number is not...
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Mar 2013 22:01:59 +0000 (23:01 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 21 Mar 2013 23:12:37 +0000 (00:12 +0100)
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.

src/libsystemd-bus/sd-bus.c
src/libsystemd-bus/sd-bus.h

index d0a36081bcf080cbaaa2b316bc37b2e059dc584d..ad840cc875c6e4bf87ab072435f8b620a58527b1 100644 (file)
@@ -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;
index ce92ee7df610bc4373c09fe2737fe46ad0aba7b4..a759f54f3e1f82f94b71bf72eedda974d10eabcb 100644 (file)
@@ -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