diff options
Diffstat (limited to 'src/libsystemd-bus/test-bus-chat.c')
-rw-r--r-- | src/libsystemd-bus/test-bus-chat.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c index 9e14824186..d8677cc9e8 100644 --- a/src/libsystemd-bus/test-bus-chat.c +++ b/src/libsystemd-bus/test-bus-chat.c @@ -264,8 +264,9 @@ static void* client2(void*p) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL; sd_bus *bus = NULL; sd_bus_error error = SD_BUS_ERROR_INIT; - int r; bool quit = false; + const char *mid; + int r; r = sd_bus_open_user(&bus); if (r < 0) { @@ -277,6 +278,35 @@ static void* client2(void*p) { bus, "org.freedesktop.systemd.test", "/", + "org.freedesktop.DBus.Peer", + "GetMachineId", + &m); + if (r < 0) { + log_error("Failed to allocate method call: %s", strerror(-r)); + goto finish; + } + + r = sd_bus_send_with_reply_and_block(bus, m, 0, &error, &reply); + if (r < 0) { + log_error("Failed to issue method call: %s", bus_error_message(&error, -r)); + goto finish; + } + + r = sd_bus_message_read(reply, "s", &mid); + if (r < 0) { + log_error("Failed to parse machine ID: %s", strerror(-r)); + goto finish; + } + + log_info("Machine ID is %s.", mid); + + sd_bus_message_unref(m); + m = NULL; + + r = sd_bus_message_new_method_call( + bus, + "org.freedesktop.systemd.test", + "/", "org.freedesktop.systemd.test", "Slow", &m); @@ -285,6 +315,9 @@ static void* client2(void*p) { goto finish; } + sd_bus_message_unref(reply); + reply = NULL; + r = sd_bus_send_with_reply_and_block(bus, m, 200 * USEC_PER_MSEC, &error, &reply); if (r < 0) log_info("Failed to issue method call: %s", bus_error_message(&error, -r)); |