mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
Cancel l2cap connection result future on abort
This cancels the `connection_result` future of LeCreditBasedChannel when abort() is called, e.g. if the LE connection disconnects. This makes it possible for code waiting for a connection to open to detect that the connection has failed. Fixes google/bumble#825
This commit is contained in:
@@ -1149,6 +1149,9 @@ class LeCreditBasedChannel(utils.EventEmitter):
|
||||
def abort(self) -> None:
|
||||
if self.state == self.State.CONNECTED:
|
||||
self._change_state(self.State.DISCONNECTED)
|
||||
if self.state == self.State.CONNECTING:
|
||||
if self.connection_result is not None:
|
||||
self.connection_result.cancel()
|
||||
|
||||
def on_pdu(self, pdu: bytes) -> None:
|
||||
if self.sink is None:
|
||||
|
||||
Reference in New Issue
Block a user