Diff between 472c0d30038239542b3876da8d63f2ae86b16600 and df0dfc268ac5f75a6006cc6f7bd881829b4aae64

Changed Files

File Additions Deletions Status
android/gatt.c +7 -3 modified

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index da6bbf0..5ce5f4d 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -638,6 +638,13 @@ static void connection_cleanup(struct gatt_device *device)
 		queue_remove_all(device->services, NULL, NULL, destroy_service);
 
 	device_set_state(device, DEVICE_DISCONNECTED);
+
+	if (!queue_isempty(device->autoconnect_apps)) {
+		auto_connect_le(device);
+		device_set_state(device, DEVICE_CONNECT_INIT);
+	} else {
+		bt_auto_connect_remove(&device->bdaddr);
+	}
 }
 
 static void destroy_gatt_app(void *data)
@@ -1451,9 +1458,6 @@ static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 
 	device_set_state(dev, DEVICE_CONNECTED);
 
-	if (queue_isempty(dev->autoconnect_apps))
-		bt_auto_connect_remove(&dev->bdaddr);
-
 	/* Send exchange mtu request as we assume being client and server */
 	/* TODO: Dont exchange mtu if no client apps */
 	send_exchange_mtu_request(dev);