Skip to content
Snippets Groups Projects
  • Rob Swindell's avatar
    c66f0887
    Fix crash after failing to connect to MQTT broker · c66f0887
    Rob Swindell authored
    We need to call mqtt_shutdown() instead of mqtt_close() to have the mosquitto
    (loop) thread stopped.
    
    Upon connect failure, call the mqtt_shutdown() *before* calling lprintf->lputs,
    which would eventually try to MQTT-publish the log message.
    
    The call to mqtt_connect() can block for a while, so raise the log severity
    of the "connecting to broker" message from DEBUG to INFO. Otherwise, a bad
    MQTT broker address or port would make the servers just appear to hang during
    initialization, for no reason.
    c66f0887
    History
    Fix crash after failing to connect to MQTT broker
    Rob Swindell authored
    We need to call mqtt_shutdown() instead of mqtt_close() to have the mosquitto
    (loop) thread stopped.
    
    Upon connect failure, call the mqtt_shutdown() *before* calling lprintf->lputs,
    which would eventually try to MQTT-publish the log message.
    
    The call to mqtt_connect() can block for a while, so raise the log severity
    of the "connecting to broker" message from DEBUG to INFO. Otherwise, a bad
    MQTT broker address or port would make the servers just appear to hang during
    initialization, for no reason.