diff --git a/bumble/device.py b/bumble/device.py index b5137c6..a971391 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -1827,7 +1827,7 @@ class Device(CompositeEventEmitter): set. Notes: - * A `connect` to the same peer will also complete this call. + * A `connect` to the same peer will not complete this call. * The `timeout` parameter is only handled while waiting for the connection request, once received and accepted, the controller shall issue a connection complete event. @@ -2409,16 +2409,6 @@ class Device(CompositeEventEmitter): ) self.connections[connection_handle] = connection - # We may have an accept ongoing waiting for a connection request for - # `peer_address`. - # Typically happen when using `connect` to the same `peer_address` we are - # waiting for with an `accept`. - # In this case, set the completed `connection` to the `accept` future - # result. - if peer_address in self.classic_pending_accepts: - future, *_ = self.classic_pending_accepts.pop(peer_address) - future.set_result(connection) - # Emit an event to notify listeners of the new connection self.emit('connection', connection) else: diff --git a/bumble/smp.py b/bumble/smp.py index 8c0c50a..abcbd67 100644 --- a/bumble/smp.py +++ b/bumble/smp.py @@ -498,7 +498,7 @@ class PairingDelegate: DISPLAY_OUTPUT_ONLY = SMP_DISPLAY_ONLY_IO_CAPABILITY DISPLAY_OUTPUT_AND_YES_NO_INPUT = SMP_DISPLAY_YES_NO_IO_CAPABILITY DISPLAY_OUTPUT_AND_KEYBOARD_INPUT = SMP_KEYBOARD_DISPLAY_IO_CAPABILITY - DEFAULT_KEY_DISTRIBUTION = ( + DEFAULT_KEY_DISTRIBUTION: int = ( SMP_ENC_KEY_DISTRIBUTION_FLAG | SMP_ID_KEY_DISTRIBUTION_FLAG ) diff --git a/tests/device_test.py b/tests/device_test.py index 07aecdd..1bcd0d0 100644 --- a/tests/device_test.py +++ b/tests/device_test.py @@ -197,7 +197,7 @@ async def test_device_connect_parallel(): d1.host.set_packet_sink(Sink(d1_flow())) d2.host.set_packet_sink(Sink(d2_flow())) - [c01, c02, a10, a20, a01] = await asyncio.gather( + [c01, c02, a10, a20] = await asyncio.gather( *[ asyncio.create_task( d0.connect(d1.public_address, transport=BT_BR_EDR_TRANSPORT) @@ -207,7 +207,6 @@ async def test_device_connect_parallel(): ), 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)), ] ) @@ -215,11 +214,9 @@ async def test_device_connect_parallel(): assert type(c02) == Connection assert type(a10) == Connection assert type(a20) == Connection - assert type(a01) == Connection assert c01.handle == a10.handle and c01.handle == 0x100 assert c02.handle == a20.handle and c02.handle == 0x101 - assert a01 == c01 # -----------------------------------------------------------------------------