Mesh: Unload Network before deinitialiation 99/241899/1
authorAnupam Roy <anupam.r@samsung.com>
Thu, 20 Aug 2020 16:26:52 +0000 (21:56 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Thu, 20 Aug 2020 16:26:52 +0000 (21:56 +0530)
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 <anupam.r@samsung.com>
src/bluetooth-mesh.c

index 7df8f01..a094737 100644 (file)
@@ -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;
 }