Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 851fab54 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "floss: btclient: Prevent deadlock in telephony enable"

parents e40fa791 328bf78f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -292,7 +292,14 @@ impl IBluetoothCallback for BtCallback {
    fn on_sdp_record_created(&mut self, record: BtSdpRecord, handle: i32) {
        print_info!("SDP record handle={} created", handle);
        if let BtSdpRecord::Mps(_) = record {
            self.context.lock().unwrap().mps_sdp_handle = Some(handle);
            let context = self.context.clone();
            // Callbacks first lock the DBus resource and then lock the context,
            // while the command handlers lock them in the reversed order.
            // `telephony enable` command happens to deadlock easily,
            // so use async call to prevent deadlock here.
            tokio::spawn(async move {
                context.lock().unwrap().mps_sdp_handle = Some(handle);
            });
        }
    }
}