Skip to contentSkip to conversation

gdbus: properly init client connected state

PATCH In review Matt Schulte 2 participants 2 messages Feb 6, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdbus: properly init client connected state

GDBusClient struct's connected member was being initialize to false for all new clients even if the connection was connected. This changes the GDBusClient connected field to be initialized from the state of the dbus connection

---
 gdbus/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gdbus/client.c +1 -1
index eaab7d50b..a41ce1a7f 100644
@@ -1316,7 +1316,7 @@ GDBusClient *g_dbus_client_new_full(DBusConnection *connection,
 	client->service_name = g_strdup(service);
 	client->base_path = g_strdup(path);
 	client->root_path = g_strdup(root_path);
-	client->connected = FALSE;
+	client->connected = dbus_connection_get_is_connected(connection);
 
 	client->match_rules = g_ptr_array_sized_new(1);
 	g_ptr_array_set_free_func(client->match_rules, g_free);
Signature · 1 line
2.16.1
#1 lore raw

Hi Matt,

Quoted 13 lines · Matt Schulte

GDBusClient struct's connected member was being initialize to false for all new clients even if the connection was connected. This changes the GDBusClient connected field to be initialized from the state of the dbus connection

---
 gdbus/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gdbus/client.c +0 -0
index eaab7d50b..a41ce1a7f 100644

gdbus/client.c GDBusClient *g_dbus_client_new_full(DBusConnection *connection, · line 1319

Quoted 5 lines
gdbus/client.c +1 -1
@@ -1316,7 +1316,7 @@ GDBusClient *g_dbus_client_new_full(DBusConnection *connection,
        client->service_name = g_strdup(service);
        client->base_path = g_strdup(path);
        client->root_path = g_strdup(root_path);
-       client->connected = FALSE;
+       client->connected = dbus_connection_get_is_connected(connection);

This is actually to track if the client service name is available on the bus, not the local connection passed as parameter which shall always be connected, if the service has not been acquired yet it will wait until it appears.

Quoted 9 lines
gdbus/client.c +0 -1
        client->match_rules = g_ptr_array_sized_new(1);
        g_ptr_array_set_free_func(client->match_rules, g_free);
--

2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Luiz Augusto von Dentz