Skip to content

Commit d5fffe9

Browse files
committed
enforce loop timeout < socket timeout
fixes #195
1 parent 70faa4f commit d5fffe9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: adafruit_minimqtt/adafruit_minimqtt.py

+5
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,11 @@ def loop(self, timeout: float = 0) -> Optional[list[int]]:
10291029
:param float timeout: return after this timeout, in seconds.
10301030
10311031
"""
1032+
if timeout < self._socket_timeout:
1033+
raise MMQTTException(
1034+
f"loop timeout ({timeout}) must be bigger than socket timeout ({self._socket_timeout})"
1035+
)
1036+
10321037
self._connected()
10331038
self.logger.debug(f"waiting for messages for {timeout} seconds")
10341039
if self._timestamp == 0:

0 commit comments

Comments
 (0)