From e9590268bfc11844b4f9ba683b133ab005cbedd8 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Sat, 17 Sep 2022 20:09:03 -0700 Subject: [PATCH] _wait_for_msg(): accept EAGAIN in addition to ETIMEDOUT You get EAGAIN when passing a timeout value of 0 and there is no data in the buffer. --- adafruit_minimqtt/adafruit_minimqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_minimqtt/adafruit_minimqtt.py b/adafruit_minimqtt/adafruit_minimqtt.py index 801605f..2a5889f 100644 --- a/adafruit_minimqtt/adafruit_minimqtt.py +++ b/adafruit_minimqtt/adafruit_minimqtt.py @@ -870,7 +870,7 @@ def _wait_for_msg(self, timeout=0.1): try: res = self._sock_exact_recv(1) except OSError as error: - if error.errno == errno.ETIMEDOUT: + if error.errno in (errno.ETIMEDOUT, errno.EAGAIN): # raised by a socket timeout if 0 bytes were present return None raise MMQTTException from error