summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-chat.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-22 01:49:56 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-22 01:49:56 +0100
commitd728d708c3ccfcb34f6d7673f7855fbf0c10aeec (patch)
treed6d059970324202b65a5077da38a566f356c403d /src/libsystemd-bus/test-bus-chat.c
parent9f26c90cb50c45d4549c4dd569917b4ac143b94d (diff)
bus: rework synchronization logic
Instead of allowing certain actions fail during authentication and connection setup, implicitly synchronize on the connection to be set up completely before returning.
Diffstat (limited to 'src/libsystemd-bus/test-bus-chat.c')
-rw-r--r--src/libsystemd-bus/test-bus-chat.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c
index d8677cc9e8..5f533cc6d0 100644
--- a/src/libsystemd-bus/test-bus-chat.c
+++ b/src/libsystemd-bus/test-bus-chat.c
@@ -33,6 +33,7 @@
static int server_init(sd_bus **_bus) {
sd_bus *bus = NULL;
+ sd_id128_t id;
int r;
assert(_bus);
@@ -43,6 +44,16 @@ static int server_init(sd_bus **_bus) {
goto fail;
}
+ r = sd_bus_get_peer(bus, &id);
+ if (r < 0) {
+ log_error("Failed to get peer ID: %s", strerror(-r));
+ goto fail;
+ }
+
+ log_info("Peer ID is " SD_ID128_FORMAT_STR ".", SD_ID128_FORMAT_VAL(id));
+ log_info("Can send file handles: %i", sd_bus_can_send(bus, 'h'));
+ log_info("Unique ID: %s", strna(sd_bus_get_unique_name(bus)));
+
r = sd_bus_request_name(bus, "org.freedesktop.systemd.test", 0);
if (r < 0) {
log_error("Failed to acquire name: %s", strerror(-r));