From 223804c6fdcca642308dde485db75c2721c176bb 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 b22c173b..d329599d 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -4296,7 +4296,7 @@ def _recv_impl(self, length: int) -> bytes: else: raise BlockingIOError - except OSError: + except ConnectionError: self.connected = False return b''