Skip to content

Commit b394623

Browse files
committed
aioble: Raise correct error if l2cap disconnects in middle of send.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 6e24cff commit b394623

File tree

1 file changed

+1
-1
lines changed
  • micropython/bluetooth/aioble/aioble

1 file changed

+1
-1
lines changed

micropython/bluetooth/aioble/aioble/l2cap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ def available(self):
133133
# Waits until the channel is free and then sends buf.
134134
# If the buffer is larger than the MTU it will be sent in chunks.
135135
async def send(self, buf, timeout_ms=None, chunk_size=None):
136-
self._assert_connected()
137136
offset = 0
138137
chunk_size = min(self.our_mtu * 2, self.peer_mtu, chunk_size or self.peer_mtu)
139138
mv = memoryview(buf)
140139
while offset < len(buf):
141140
if self._stalled:
142141
await self.flush(timeout_ms)
143142
# l2cap_send returns True if you can send immediately.
143+
self._assert_connected()
144144
self._stalled = not ble.l2cap_send(
145145
self._connection._conn_handle,
146146
self._cid,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy