RxBluetoothKit icon indicating copy to clipboard operation
RxBluetoothKit copied to clipboard

Disconnect didn't occur on disposal of establishConnection Disposable

Open philfi opened this issue 6 years ago • 0 comments

Describe the bug Working on an app that implements a wrapper class that tracks Connected Peripherals and retains the disposable so it can be used for disconnect purposes per the suggestions from: https://github.com/Polidea/RxBluetoothKit/issues/278 This has been working quite well though we recently had an experience where the establishConnection disposable was disposed as usual but the disconnect did not occur. This was confirmed in a couple ways, 1. The device still showed up as Connected in Settings -> Bluetooth and 2. The observeDisconnect subscription was never triggered or failed.

Haven't been able to repro but wanted to share in case anyone else comes across this issue. As a fix in the short term we're adding an explicit cancelPeripheralConnection after the disposal to ensure that it happens. This has not led to any negative side effects afaik.

To Reproduce Unable to reproduce as of yet.

Expected behavior Peripheral is disconnected from the Phone.

Environment:

  • Device: iPhone XS
  • OS: 12.1.2
  • Library version: 5.1.4
  • Swift version: 4.2

philfi avatar Jan 22 '19 19:01 philfi