Skip to content

Commit 91ff5fe

Browse files
committed
Cancel stream only if stopNotifying is false
1 parent 3d79806 commit 91ff5fe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SwiftBluetooth/Peripheral/Peripheral+async.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public extension Peripheral {
4444

4545
let eventSubscription = eventSubscriptions.queue { event, done in
4646
guard case .updateNotificationState(let foundCharacteristic, _) = event,
47-
foundCharacteristic.uuid == characteristic.uuid else { return }
47+
foundCharacteristic.uuid == characteristic.uuid,
48+
!foundCharacteristic.isNotifying else { return }
4849

4950
cont.finish()
5051
valueSubscription.cancel()

0 commit comments

Comments
 (0)