mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-22 08:08:22 +03:00
fix: prevent MQTT from setting connected state on failed connections
When the MQTT broker rejects a connection (bad credentials, not authorized, etc.), _on_connect still unconditionally sets connected=True, subscribes to topics, and calls _set_initial_topics(). This causes publish() to attempt sending messages to a broker that rejected the connection. Add an early return after logging the connection error so the client correctly remains in a disconnected state.
This commit is contained in:
parent
722ef6a1fe
commit
2233be8e7a
@ -199,6 +199,7 @@ class MqttClient(Communicator):
|
|||||||
"Unable to connect to MQTT server: Connection refused. Error code: "
|
"Unable to connect to MQTT server: Connection refused. Error code: "
|
||||||
+ reason_code.getName()
|
+ reason_code.getName()
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
self.connected = True
|
self.connected = True
|
||||||
logger.debug("MQTT connected")
|
logger.debug("MQTT connected")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user