dbus: Wait for 'ServicesResolved' before telling we are connected

pull/108/head
Olivier Martin 2019-06-27 14:49:55 +02:00 committed by Olivier Martin
parent 2accddb3c7
commit 1e0e57070f
1 changed files with 9 additions and 7 deletions

View File

@ -274,18 +274,20 @@ gboolean on_handle_device_property_change(
g_variant_get (arg_changed_properties, "a{sv}", &iter);
while (g_variant_iter_loop (iter, "{&sv}", &key, &value)) {
if (strcmp(key, "Connected") == 0) {
if (g_variant_get_boolean(value)) {
// Stop the timeout for connection
g_source_remove(conn_context->connection_timeout);
// Tell we are now connected
g_main_loop_quit(conn_context->connection_loop);
} else {
if (!g_variant_get_boolean(value)) {
printf("on_handle_device_property_change: Connected FALSE\n");
// Disconnection case
if (connection->disconnection_handler) {
printf("[C] Call disconnection handler:%p\n", connection->disconnection_handler);
connection->disconnection_handler(connection->disconnection_user_data);
}
}
} else if (strcmp(key, "ServicesResolved") == 0) {
// Stop the timeout for connection
g_source_remove(conn_context->connection_timeout);
// Tell we are now connected
g_main_loop_quit(conn_context->connection_loop);
}
}
}