Skip to content

Commit

Permalink
Cancel stream only if stopNotifying is false
Browse files Browse the repository at this point in the history
  • Loading branch information
exPHAT committed Sep 29, 2023
1 parent 3d79806 commit 91ff5fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/SwiftBluetooth/Peripheral/Peripheral+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public extension Peripheral {

let eventSubscription = eventSubscriptions.queue { event, done in
guard case .updateNotificationState(let foundCharacteristic, _) = event,
foundCharacteristic.uuid == characteristic.uuid else { return }
foundCharacteristic.uuid == characteristic.uuid,
!foundCharacteristic.isNotifying else { return }

cont.finish()
valueSubscription.cancel()
Expand Down

0 comments on commit 91ff5fe

Please sign in to comment.