Explorar el Código

Disable MQTT connect error callback after successful connection (#2262)

Disable the error callback of mqtt.client:connect() after a successful connection.
This will prevent this function to be called after a future disconnection.
Instead the "offline" function is called.
Frank Exoo hace 6 años
padre
commit
e9ed1a8c59
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      app/modules/mqtt.c

+ 2 - 0
app/modules/mqtt.c

@@ -338,6 +338,8 @@ READPACKET:
         mud->connState = MQTT_DATA;
         NODE_DBG("MQTT: Connected\r\n");
         mud->keepalive_sent = 0;
+        luaL_unref(L, LUA_REGISTRYINDEX, mud->cb_connect_fail_ref);
+        mud->cb_connect_fail_ref = LUA_NOREF;
         if (mud->mqtt_state.auto_reconnect == RECONNECT_POSSIBLE) {
           mud->mqtt_state.auto_reconnect = RECONNECT_ON;
         }