Skip to content

Commit 62e3b07

Browse files
dhalbertvladak
authored andcommitted
Handle ESP32SPI Socket.send(), which does not return a byte count
1 parent a899f49 commit 62e3b07

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ def _send_bytes(
475475
view = memoryview(buffer)
476476
while bytes_sent < bytes_to_send:
477477
try:
478-
bytes_sent += self._sock.send(view[bytes_sent:])
478+
sent_now = self._sock.send(view[bytes_sent:])
479+
# Some versions of `Socket.send()` do not return the number of bytes sent.
480+
if not isinstance(sent_now, int):
481+
return
482+
bytes_sent += sent_now
479483
except OSError as exc:
480484
if exc.errno == errno.EAGAIN:
481485
continue

0 commit comments

Comments
 (0)