Skip to content

Commit 3718d0f

Browse files
committed
Retain peripheral references for the lifetime of the CentralManager
1 parent ba7f530 commit 3718d0f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/SwiftBluetooth/CentralManager/CentralManagerDelegateWrapper.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ class CentralManagerDelegateWrapper: NSObject, CBCentralManagerDelegate {
3737

3838
parent.connectedPeripherals.remove(peripheral)
3939
parent.delegate?.centralManager(parent, didDisconnectPeripheral: peripheral, error: error)
40-
parent.removePeripheral(peripheral.cbPeripheral)
40+
41+
// Not deleting peripheral instance for now. Might cause some issues for
42+
// people retaining a reference to a disconnected peripheral that later reconnects.
43+
// Maybe change this?
44+
//
45+
// parent.removePeripheral(peripheral.cbPeripheral)
4146

4247
parent.eventQueue.async {
4348
parent.eventSubscriptions.recieve(.disconnected(peripheral, error))

0 commit comments

Comments
 (0)