mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
Fix double-disable legacy advertising set
When legacy advertising set is disabled passively(by set termination), the legacy advertising set won't be released, and the next stop_advertising() call will try to disable it again and cause an error.
This commit is contained in:
@@ -2065,7 +2065,9 @@ class Device(CompositeEventEmitter):
|
||||
"""Stop legacy advertising."""
|
||||
# Disable advertising
|
||||
if self.legacy_advertising_set:
|
||||
await self.legacy_advertising_set.stop()
|
||||
if self.legacy_advertising_set.enabled:
|
||||
await self.legacy_advertising_set.stop()
|
||||
await self.legacy_advertising_set.remove()
|
||||
self.legacy_advertising_set = None
|
||||
elif self.legacy_advertiser:
|
||||
await self.legacy_advertiser.stop()
|
||||
@@ -2207,9 +2209,6 @@ class Device(CompositeEventEmitter):
|
||||
if self.legacy_advertiser:
|
||||
return True
|
||||
|
||||
if self.legacy_advertising_set and self.legacy_advertising_set.enabled:
|
||||
return True
|
||||
|
||||
return any(
|
||||
advertising_set.enabled
|
||||
for advertising_set in self.extended_advertising_sets.values()
|
||||
@@ -3541,11 +3540,9 @@ class Device(CompositeEventEmitter):
|
||||
connection_handle,
|
||||
number_of_completed_extended_advertising_events,
|
||||
):
|
||||
# Legacy advertising set is also one of extended advertising sets.
|
||||
if not (
|
||||
advertising_set := (
|
||||
self.extended_advertising_sets.get(advertising_handle)
|
||||
or self.legacy_advertising_set
|
||||
)
|
||||
advertising_set := self.extended_advertising_sets.get(advertising_handle)
|
||||
):
|
||||
logger.warning(f'advertising set {advertising_handle} not found')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user