classic: add BR/EDR accept connection logic

This commit is contained in:
Abel Lucas
2022-10-19 19:00:03 +00:00
parent 7044102e05
commit 56ed46adfa
4 changed files with 170 additions and 12 deletions
+12 -5
View File
@@ -158,16 +158,23 @@ async def test_device_connect_parallel():
d1.host.set_packet_sink(Sink(d1_flow()))
d2.host.set_packet_sink(Sink(d2_flow()))
[c1, c2] = await asyncio.gather(*[
[c01, c02, a10, a20, a01] = await asyncio.gather(*[
asyncio.create_task(d0.connect(d1.public_address, transport=BT_BR_EDR_TRANSPORT)),
asyncio.create_task(d0.connect(d2.public_address, transport=BT_BR_EDR_TRANSPORT)),
asyncio.create_task(d1.accept(peer_address=d0.public_address)),
asyncio.create_task(d2.accept()),
asyncio.create_task(d0.accept(peer_address=d1.public_address)),
])
assert type(c1) == Connection
assert type(c2) == Connection
assert type(c01) == Connection
assert type(c02) == Connection
assert type(a10) == Connection
assert type(a20) == Connection
assert type(a01) == Connection
assert c1.handle == 0x100
assert c2.handle == 0x101
assert c01.handle == a10.handle and c01.handle == 0x100
assert c02.handle == a20.handle and c02.handle == 0x101
assert a01 == c01
# -----------------------------------------------------------------------------