From 4d6e61201b2fa1c1d19acea0b5957604a6dfdeea Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 6 Nov 2015 14:10:02 +0100 Subject: [PATCH 2/2] Fix test cases running client and server dispatch design issue. DBus test cases running the server *and* client loop in the same process assumed that all messages send from the server has to be received in one client dispatch, which is not the case in all environments. https://bugs.freedesktop.org/show_bug.cgi?id=92721 --- bus/dispatch.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/bus/dispatch.c b/bus/dispatch.c index ae7ac38..4874501 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -674,9 +674,14 @@ check_service_owner_changed_foreach (DBusConnection *connection, message = pop_message_waiting_for_memory (connection); if (message == NULL) { - _dbus_warn ("Did not receive a message on %p, expecting %s\n", - connection, "NameOwnerChanged"); - goto out; + block_connection_until_message_from_bus (d->context, connection, "NameOwnerChanged"); + message = pop_message_waiting_for_memory (connection); + if (message == NULL) + { + _dbus_warn ("Did not receive a message on %p, expecting %s\n", + connection, "NameOwnerChanged"); + goto out; + } } else if (!dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, @@ -1029,9 +1034,14 @@ check_hello_message (BusContext *context, message = pop_message_waiting_for_memory (connection); if (message == NULL) { - _dbus_warn ("Expecting %s, got nothing\n", + block_connection_until_message_from_bus (context, connection, "signal NameAcquired"); + message = pop_message_waiting_for_memory (connection); + if (message == NULL) + { + _dbus_warn ("Expecting %s, got nothing\n", "NameAcquired"); - goto out; + goto out; + } } if (! dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameAcquired")) -- 1.8.4.5