From bf5a87c01a5fb0766d2bc384d7b6c2cde50209be Mon Sep 17 00:00:00 2001 From: Anupam Roy Date: Thu, 20 Aug 2020 21:56:52 +0530 Subject: [PATCH] Mesh: Unload Network before deinitialiation Currently, unloading only removes the network resources from bt-service layer. So, deinit of mesh stack was OK to be done before unloading of network. But, now, mesh FRWK shall request to free the network's DBUS resources(proxies) to mesh stack. So deinitialization is moved below unloading of network, to ensure, all network resouces are properly cleaned up before deinit. Change-Id: I08e208759391d87d19ba31d580f6deac70cc45c2 Signed-off-by: Anupam Roy --- src/bluetooth-mesh.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bluetooth-mesh.c b/src/bluetooth-mesh.c index 7df8f01..a094737 100644 --- a/src/bluetooth-mesh.c +++ b/src/bluetooth-mesh.c @@ -715,12 +715,6 @@ int bt_mesh_deinitialize(void) BT_CHECK_MESH_INIT_STATUS(); int error; - error = bluetooth_mesh_deinit(); - error = _bt_get_error_code(error); - if (BT_ERROR_NONE != error) - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); - - is_mesh_initialized = false; BT_INFO("Mesh: Mesh Deinitialized"); BT_INFO("Mesh: Remove each Network configuration"); @@ -732,6 +726,13 @@ int bt_mesh_deinitialize(void) BT_INFO("Mesh: After removal: Remaining Networks [%d]", g_slist_length(networks)); + error = bluetooth_mesh_deinit(); + error = _bt_get_error_code(error); + if (BT_ERROR_NONE != error) + BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); + + is_mesh_initialized = false; + FUNC_EXIT; return BT_ERROR_NONE; } -- 2.7.4