Log bluetooth advertisement before firing bleak callbacks (#80800)

The debug log was confusing because the bleak callbacks
were firing before we were logging the advertisements
pull/80819/head
J. Nick Koston 2022-10-23 04:34:03 -05:00 committed by GitHub
parent dd39ddca2f
commit 95d6859cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -433,11 +433,7 @@ class BluetoothManager:
):
return
if is_connectable_by_any_source := address in self._connectable_history:
# Bleak callbacks must get a connectable device
for callback_filters in self._bleak_callbacks:
_dispatch_bleak_callback(*callback_filters, device, advertisement_data)
is_connectable_by_any_source = address in self._connectable_history
if not connectable and is_connectable_by_any_source:
# Since we have a connectable path and our BleakClient will
# route any connection attempts to the connectable path, we
@ -456,6 +452,11 @@ class BluetoothManager:
advertisement_data.rssi,
)
if is_connectable_by_any_source:
# Bleak callbacks must get a connectable device
for callback_filters in self._bleak_callbacks:
_dispatch_bleak_callback(*callback_filters, device, advertisement_data)
for match in self._callback_index.match_callbacks(service_info):
callback = match[CALLBACK]
try: