Skip to content

Commit

Permalink
restore _send_bytes()
Browse files Browse the repository at this point in the history
  • Loading branch information
vladak committed Jan 2, 2025
1 parent 269d10b commit dfaf68e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,21 @@ def connect( # noqa: PLR0913, too many arguments in function definition
raise MMQTTException(exc_msg) from last_exception
raise MMQTTException(exc_msg)

def _send_bytes(
self,
buffer: Union[bytes, bytearray, memoryview],
):
bytes_sent: int = 0
bytes_to_send = len(buffer)
view = memoryview(buffer)
while bytes_sent < bytes_to_send:
try:
bytes_sent += self._sock.send(view[bytes_sent:])
except OSError as exc:
if exc.errno == EAGAIN:
continue
raise

def _connect( # noqa: PLR0912, PLR0913, PLR0915, Too many branches, Too many arguments, Too many statements
self,
clean_session: bool = True,
Expand Down

0 comments on commit dfaf68e

Please sign in to comment.