Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ESP32SPI Socket.send(), which does not return a byte count #235

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,11 @@ def _send_bytes(
view = memoryview(buffer)
while bytes_sent < bytes_to_send:
try:
bytes_sent += self._sock.send(view[bytes_sent:])
sent_now = self._sock.send(view[bytes_sent:])
# Some versions of `Socket.send()` do not return the number of bytes sent.
if not isinstance(sent_now, int):
return
bytes_sent += sent_now
except OSError as exc:
if exc.errno == errno.EAGAIN:
continue
Expand Down
Loading