Skip to content

Commit 07239ac

Browse files
committed
use recv_timeout instead of keep_alive
fixes #189
1 parent cbe2177 commit 07239ac

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
@@ -1068,7 +1068,7 @@ def _sock_exact_recv(
10681068
to_read = bufsize - recv_len
10691069
if to_read < 0:
10701070
raise MMQTTException(f"negative number of bytes to read: {to_read}")
1071-
read_timeout = timeout if timeout is not None else self.keep_alive
1071+
read_timeout = timeout if timeout is not None else self._recv_timeout
10721072
mv = mv[recv_len:]
10731073
while to_read > 0:
10741074
recv_len = self._sock.recv_into(mv, to_read)
@@ -1079,7 +1079,7 @@ def _sock_exact_recv(
10791079
f"Unable to receive {to_read} bytes within {read_timeout} seconds."
10801080
)
10811081
else: # ESP32SPI Impl.
1082-
# This will timeout with socket timeout (not keepalive timeout)
1082+
# This will time out with socket timeout (not receive timeout).
10831083
rc = self._sock.recv(bufsize)
10841084
if not rc:
10851085
self.logger.debug("_sock_exact_recv timeout")
@@ -1089,7 +1089,7 @@ def _sock_exact_recv(
10891089
# or raise exception if wait longer than read_timeout
10901090
to_read = bufsize - len(rc)
10911091
assert to_read >= 0
1092-
read_timeout = self.keep_alive
1092+
read_timeout = self._recv_timeout
10931093
while to_read > 0:
10941094
recv = self._sock.recv(to_read)
10951095
to_read -= len(recv)

0 commit comments

Comments
 (0)