Multiple le connections are now working correctly

This commit is contained in:
timrid
2026-02-05 12:46:41 +01:00
parent 256a1a7405
commit 79e5974946
2 changed files with 23 additions and 0 deletions

View File

@@ -604,6 +604,8 @@ class Controller:
)
)
del self.le_connections[connection.peer_address]
def create_le_connection(self, peer_address: hci.Address) -> None:
'''
Called when we receive advertisement matching connection filter.
@@ -1217,6 +1219,7 @@ class Controller:
else:
# Remove the connection
del self.classic_connections[connection.peer_address]
del self.le_connections[connection.peer_address]
elif sco_link := self.find_classic_sco_link_by_handle(handle):
if self.link:
if (

View File

@@ -309,6 +309,26 @@ async def test_legacy_advertising_disconnection(auto_restart):
assert not devices[0].is_advertising
# -----------------------------------------------------------------------------
@pytest.mark.asyncio
async def test_le_multiple_connects():
devices = TwoDevices()
for controller in devices.controllers:
controller.le_features |= hci.LeFeatureMask.LE_EXTENDED_ADVERTISING
for dev in devices:
await dev.power_on()
await devices[0].start_advertising(auto_restart=True, advertising_interval_min=1.0)
connection = await devices[1].connect(devices[0].random_address)
await connection.disconnect()
await async_barrier()
await async_barrier()
# a second connection attempt is working
connection = await devices[1].connect(devices[0].random_address)
await connection.disconnect()
# -----------------------------------------------------------------------------
@pytest.mark.asyncio
async def test_advertising_and_scanning():