mirror of
https://github.com/google/bumble.git
synced 2026-05-09 04:08:02 +00:00
Merge pull request #579 from jmdietrich-gcx/unsubscribe_characteristic_in_gatt_client
Remove characteristic in GATT Client unsubscribe() if it's the last subscriber
This commit is contained in:
@@ -898,6 +898,12 @@ class Client:
|
|||||||
) and subscriber in subscribers:
|
) and subscriber in subscribers:
|
||||||
subscribers.remove(subscriber)
|
subscribers.remove(subscriber)
|
||||||
|
|
||||||
|
# The characteristic itself is added as subscriber. If it is the
|
||||||
|
# last remaining subscriber, we remove it, such that the clean up
|
||||||
|
# works correctly. Otherwise the CCCD never is set back to 0.
|
||||||
|
if len(subscribers) == 1 and characteristic in subscribers:
|
||||||
|
subscribers.remove(characteristic)
|
||||||
|
|
||||||
# Cleanup if we removed the last one
|
# Cleanup if we removed the last one
|
||||||
if not subscribers:
|
if not subscribers:
|
||||||
del subscriber_set[characteristic.handle]
|
del subscriber_set[characteristic.handle]
|
||||||
|
|||||||
Reference in New Issue
Block a user