diff options
author | 2025-02-10 17:24:45 +1100 | |
---|---|---|
committer | 2025-02-10 22:34:15 -0800 | |
commit | edc40e9472d5efa7560d6fa2d68203a46d758987 (patch) | |
tree | 069bf37c1062c377e2b68c839cb9cf4f1aaa04e5 | |
parent | aeba6d375adfd80ef1cb71ff65c78660b490c109 (diff) |
system/rust: Wait forever for Rust module to initialize
Not waiting leads to a high chance of a later crash; it's better to wait
forever.
Fix: 385666726
Test: m com.android.btservices
Flag: EXEMPT bugfix
Change-Id: I07dd7fde11b1949606a69478cc5eca70f88ff8c9
-rw-r--r-- | system/btif/src/bluetooth.cc | 5 | ||||
-rw-r--r-- | system/rust/src/gatt/server/isolation_manager.rs | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/system/btif/src/bluetooth.cc b/system/btif/src/bluetooth.cc index 7bdf50781b..a567ba43fa 100644 --- a/system/btif/src/bluetooth.cc +++ b/system/btif/src/bluetooth.cc @@ -512,10 +512,7 @@ static void start_rust_module(void) { std::promise<void> rust_up_promise; auto rust_up_future = rust_up_promise.get_future(); stack_manager_get_interface()->start_up_rust_module_async(std::move(rust_up_promise)); - auto status = rust_up_future.wait_for(std::chrono::milliseconds(1000)); - if (status != std::future_status::ready) { - log::error("Failed to wait for rust initialization in time. May lead to unpredictable crash"); - } + rust_up_future.wait(); } static void stop_rust_module(void) { stack_manager_get_interface()->shut_down_rust_module_async(); } diff --git a/system/rust/src/gatt/server/isolation_manager.rs b/system/rust/src/gatt/server/isolation_manager.rs index b7f32a7b79..862d287085 100644 --- a/system/rust/src/gatt/server/isolation_manager.rs +++ b/system/rust/src/gatt/server/isolation_manager.rs @@ -8,7 +8,7 @@ use crate::gatt::ids::{AdvertiserId, ServerId, TransportIndex}; /// This class is responsible for tracking which connections and advertising we /// own, and using this information to decide what servers should be exposed to -/// a given connetion. +/// a given connection. #[derive(Default)] pub struct IsolationManager { advertiser_to_server: HashMap<AdvertiserId, ServerId>, |