Fix race conditions with bluetooth devices being erased while being used.

This commit is contained in:
Vibhav Pant
2023-09-26 18:34:56 +05:30
parent b4bd7ddbb8
commit 97af86a414
10 changed files with 135 additions and 157 deletions
@@ -31,7 +31,8 @@ namespace nearby {
namespace linux {
class BluetoothPairing final : public api::BluetoothPairing {
public:
BluetoothPairing(BluetoothAdapter &adapter, std::shared_ptr<BluetoothDevice> remote_device);
BluetoothPairing(BluetoothAdapter &adapter,
std::shared_ptr<BluetoothDevice> remote_device);
bool InitiatePairing(api::BluetoothPairingCallback pairing_cb) override;
bool FinishPairing(std::optional<absl::string_view> pin_code) override;
@@ -45,7 +46,8 @@ class BluetoothPairing final : public api::BluetoothPairing {
sdbus::PendingAsyncCall pair_async_call_;
std::shared_ptr<BluetoothDevice> device_;
linux::BluetoothAdapter &adapter_;
sdbus::ObjectPath device_object_path_;
linux::BluetoothAdapter adapter_;
api::BluetoothPairingCallback pairing_cb_;
};