From 7e1c9cf905fe0d5dc111fa88d94b99f3802a7765 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 7 May 2025 21:19:43 +1000 Subject: [PATCH] aioble: Raise correct error if l2cap disconnects in middle of send. Signed-off-by: Andrew Leech --- micropython/bluetooth/aioble/aioble/l2cap.py | 1 + 1 file changed, 1 insertion(+) diff --git a/micropython/bluetooth/aioble/aioble/l2cap.py b/micropython/bluetooth/aioble/aioble/l2cap.py index e2d3bd9d4..71a9779c4 100644 --- a/micropython/bluetooth/aioble/aioble/l2cap.py +++ b/micropython/bluetooth/aioble/aioble/l2cap.py @@ -141,6 +141,7 @@ async def send(self, buf, timeout_ms=None, chunk_size=None): if self._stalled: await self.flush(timeout_ms) # l2cap_send returns True if you can send immediately. + self._assert_connected() self._stalled = not ble.l2cap_send( self._connection._conn_handle, self._cid,