Skip to content

Commit a15e711

Browse files
authored
Merge pull request #235 from dhalbert/socket-send-non-int
Handle ESP32SPI Socket.send(), which does not return a byte count
2 parents cac3b41 + b47ed70 commit a15e711

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@ def _send_bytes(
473473
view = memoryview(buffer)
474474
while bytes_sent < bytes_to_send:
475475
try:
476-
bytes_sent += self._sock.send(view[bytes_sent:])
476+
sent_now = self._sock.send(view[bytes_sent:])
477+
# Some versions of `Socket.send()` do not return the number of bytes sent.
478+
if not isinstance(sent_now, int):
479+
return
480+
bytes_sent += sent_now
477481
except OSError as exc:
478482
if exc.errno == errno.EAGAIN:
479483
continue

0 commit comments

Comments
 (0)