forked from auracaster/bumble_mirror
fix legacy advertising auto restart
This commit is contained in:
@@ -3701,7 +3701,6 @@ class Device(CompositeEventEmitter):
|
|||||||
# We were connected via a legacy advertisement.
|
# We were connected via a legacy advertisement.
|
||||||
if self.legacy_advertiser:
|
if self.legacy_advertiser:
|
||||||
own_address_type = self.legacy_advertiser.own_address_type
|
own_address_type = self.legacy_advertiser.own_address_type
|
||||||
self.legacy_advertiser = None
|
|
||||||
else:
|
else:
|
||||||
# This should not happen, but just in case, pick a default.
|
# This should not happen, but just in case, pick a default.
|
||||||
logger.warning("connection without an advertiser")
|
logger.warning("connection without an advertiser")
|
||||||
@@ -3732,15 +3731,14 @@ class Device(CompositeEventEmitter):
|
|||||||
)
|
)
|
||||||
self.connections[connection_handle] = connection
|
self.connections[connection_handle] = connection
|
||||||
|
|
||||||
if (
|
if role == HCI_PERIPHERAL_ROLE and self.legacy_advertiser:
|
||||||
role == HCI_PERIPHERAL_ROLE
|
if self.legacy_advertiser.auto_restart:
|
||||||
and self.legacy_advertiser
|
connection.once(
|
||||||
and self.legacy_advertiser.auto_restart
|
'disconnection',
|
||||||
):
|
lambda _: self.abort_on('flush', self.legacy_advertiser.start()),
|
||||||
connection.once(
|
)
|
||||||
'disconnection',
|
else:
|
||||||
lambda _: self.abort_on('flush', self.legacy_advertiser.start()),
|
self.legacy_advertiser = None
|
||||||
)
|
|
||||||
|
|
||||||
if role == HCI_CENTRAL_ROLE or not self.supports_le_extended_advertising:
|
if role == HCI_CENTRAL_ROLE or not self.supports_le_extended_advertising:
|
||||||
# We can emit now, we have all the info we need
|
# We can emit now, we have all the info we need
|
||||||
|
|||||||
Reference in New Issue
Block a user