summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/sd-bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 636715f759..fbf1a5919f 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -51,6 +51,7 @@
#include "bus-util.h"
#include "bus-container.h"
#include "bus-protocol.h"
+#include "bus-track.h"
static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec);
static int attach_io_events(sd_bus *b);
@@ -131,6 +132,8 @@ static void bus_free(sd_bus *b) {
assert(b);
+ assert(!b->track_queue);
+
sd_bus_detach_event(b);
if (b->default_bus_ptr)
@@ -2000,6 +2003,11 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (bus->track_queue) {
+ *timeout_usec = 0;
+ return 1;
+ }
+
if (bus->state == BUS_CLOSING) {
*timeout_usec = 0;
return 1;
@@ -2282,6 +2290,16 @@ finish:
return r;
}
+static int dispatch_track(sd_bus *bus) {
+ assert(bus);
+
+ if (!bus->track_queue)
+ return 0;
+
+ bus_track_dispatch(bus->track_queue);
+ return 1;
+}
+
static int process_running(sd_bus *bus, bool hint_priority, int64_t priority, sd_bus_message **ret) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r;
@@ -2297,6 +2315,10 @@ static int process_running(sd_bus *bus, bool hint_priority, int64_t priority, sd
if (r != 0)
goto null_message;
+ r = dispatch_track(bus);
+ if (r != 0)
+ goto null_message;
+
r = dispatch_rqueue(bus, hint_priority, priority, &m);
if (r < 0)
return r;