Diff between 898635a9d2c67cebcb0af8780a087018b7c49de3 and 7dc00a0ec4ef7fc78ccef237e2486b27adff5503

Changed Files

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

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index 772c253..48da9cc 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -364,8 +364,14 @@ static bool match_connection_by_device_and_app(const void *data,
 
 static struct app_connection *find_connection_by_id(int32_t conn_id)
 {
-	return queue_find(app_connections, match_connection_by_id,
+	struct app_connection *conn;
+
+	conn = queue_find(app_connections, match_connection_by_id,
 							INT_TO_PTR(conn_id));
+	if (conn && conn->device->state == DEVICE_CONNECTED)
+		return conn;
+
+	return NULL;
 }
 
 static bool match_connection_by_device(const void *data, const void *user_data)