Skip to content

Commit b99707a

Browse files
committed
use recv_timeout instead of keep_alive
fixes #189
1 parent 70faa4f commit b99707a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11611161
to_read = bufsize - recv_len
11621162
if to_read < 0:
11631163
raise MMQTTException(f"negative number of bytes to read: {to_read}")
1164-
read_timeout = self.keep_alive
1164+
read_timeout = self._recv_timeout
11651165
mv = mv[recv_len:]
11661166
while to_read > 0:
11671167
recv_len = self._sock.recv_into(mv, to_read)
@@ -1172,7 +1172,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11721172
f"Unable to receive {to_read} bytes within {read_timeout} seconds."
11731173
)
11741174
else: # ESP32SPI Impl.
1175-
# This will timeout with socket timeout (not keepalive timeout)
1175+
# This will time out with socket timeout (not receive timeout).
11761176
rc = self._sock.recv(bufsize)
11771177
if not rc:
11781178
self.logger.debug("_sock_exact_recv timeout")
@@ -1182,7 +1182,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11821182
# or raise exception if wait longer than read_timeout
11831183
to_read = bufsize - len(rc)
11841184
assert to_read >= 0
1185-
read_timeout = self.keep_alive
1185+
read_timeout = self._recv_timeout
11861186
while to_read > 0:
11871187
recv = self._sock.recv(to_read)
11881188
to_read -= len(recv)

0 commit comments

Comments
 (0)