From 8fa8596466539f06e37c1a4a82c8c5bece9c9158 Mon Sep 17 00:00:00 2001 From: Pierre Fersing Date: Sat, 13 Jan 2024 18:01:09 +0100 Subject: [PATCH] Don't break Websocket connection on BlockingIO & like error Previous commit catcher wider exception in WebsocketWrapper (OSError), which include temporary error like BlockingIOError, SSLWantReadError... This caused Websocket connection to break and cause client reconnection when it should only cause a later retry. Revert to catching previous ConnectionError, which should be fine, other fatal error like SSLEOFError that might happen would still be catched by caller (_sock_recv) which will take care of closing the websocket connection --- src/paho/mqtt/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 14aed7cf..4538d6c4 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -4313,7 +4313,7 @@ def _recv_impl(self, length: int) -> bytes: else: raise BlockingIOError - except OSError: + except ConnectionError: self.connected = False return b''