From c9748778ac2932d86e10a89f269766e938c40961 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Mon, 24 Nov 2014 15:03:52 -0800 Subject: [PATCH] shared/gatt-client: Call ready_handler only in init Currently disconnect_cb calls ready_handler to notify the upper layer if a disconnect occurred during initialization. This patch fixes it so that the handler is only called if in_init is set. --- src/shared/gatt-client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index 4a645eba2..033cba17f 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1455,6 +1455,7 @@ static void bt_gatt_client_free(struct bt_gatt_client *client) static void att_disconnect_cb(void *user_data) { struct bt_gatt_client *client = user_data; + bool in_init = client->in_init; client->disc_id = 0; @@ -1464,7 +1465,7 @@ static void att_disconnect_cb(void *user_data) client->in_init = false; client->ready = false; - if (client->ready_callback) + if (in_init && client->ready_callback) client->ready_callback(false, 0, client->ready_data); } -- 2.47.3