We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 25a9218 + 8595e36 commit 62abc1aCopy full SHA for 62abc1a
adafruit_minimqtt/adafruit_minimqtt.py
@@ -436,6 +436,7 @@ def connect(
436
except (MemoryError, OSError, RuntimeError) as e:
437
if isinstance(e, RuntimeError) and e.args == ("pystack exhausted",):
438
raise
439
+ self._close_socket()
440
self.logger.warning(f"Socket error when connecting: {e}")
441
last_exception = e
442
backoff = False
@@ -591,7 +592,7 @@ def disconnect(self) -> None:
591
592
self.logger.debug("Sending DISCONNECT packet to broker")
593
try:
594
self._sock.send(MQTT_DISCONNECT)
- except RuntimeError as e:
595
+ except (MemoryError, OSError, RuntimeError) as e:
596
self.logger.warning(f"Unable to send DISCONNECT packet: {e}")
597
self._close_socket()
598
self._is_connected = False
0 commit comments