Skip to content

Commit 149f040

Browse files
committed
use recv_timeout instead of keep_alive
fixes #189
1 parent 1c25441 commit 149f040

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
@@ -1115,7 +1115,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11151115
to_read = bufsize - recv_len
11161116
if to_read < 0:
11171117
raise MMQTTException(f"negative number of bytes to read: {to_read}")
1118-
read_timeout = self.keep_alive
1118+
read_timeout = self._recv_timeout
11191119
mv = mv[recv_len:]
11201120
while to_read > 0:
11211121
recv_len = self._sock.recv_into(mv, to_read)
@@ -1126,7 +1126,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11261126
f"Unable to receive {to_read} bytes within {read_timeout} seconds."
11271127
)
11281128
else: # ESP32SPI Impl.
1129-
# This will timeout with socket timeout (not keepalive timeout)
1129+
# This will time out with socket timeout (not receive timeout).
11301130
rc = self._sock.recv(bufsize)
11311131
if not rc:
11321132
self.logger.debug("_sock_exact_recv timeout")
@@ -1136,7 +1136,7 @@ def _sock_exact_recv(self, bufsize: int) -> bytearray:
11361136
# or raise exception if wait longer than read_timeout
11371137
to_read = bufsize - len(rc)
11381138
assert to_read >= 0
1139-
read_timeout = self.keep_alive
1139+
read_timeout = self._recv_timeout
11401140
while to_read > 0:
11411141
recv = self._sock.recv(to_read)
11421142
to_read -= len(recv)

0 commit comments

Comments
 (0)