device: remove "feature" which enable accept to return the same connection has connect

This commit is contained in:
uael
2023-02-10 20:10:59 +00:00
parent 1321c7da81
commit ad27de7717
2 changed files with 2 additions and 15 deletions

View File

@@ -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: