From 25ef0e15783b212e9d79cf3e8a30acbf7fdca1a0 Mon Sep 17 00:00:00 2001 From: Benjamin Runnels Date: Sun, 29 Nov 2015 09:16:30 -0600 Subject: [PATCH] Fixed bug where callbacks were not getting called if the CMD MQTT client called connect while the ESP MQTT client was connected or disconnected. --- mqtt/mqtt_cmd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mqtt/mqtt_cmd.c b/mqtt/mqtt_cmd.c index 4260be9..3cca79b 100644 --- a/mqtt/mqtt_cmd.c +++ b/mqtt/mqtt_cmd.c @@ -314,6 +314,14 @@ MQTTCMD_Connect(CmdPacket *cmd) { CMD_Request(&req, cmd); #ifdef MQTT_1_CLIENT + + if (mqttClient.connState == MQTT_CONNECTED && mqttClient.cmdConnectedCb) { + mqttClient.cmdConnectedCb((uint32_t*)&mqttClient); + } + else if (mqttClient.connState == MQTT_DISCONNECTED && mqttClient.cmdDisconnectedCb) { + mqttClient.cmdDisconnectedCb((uint32_t*)&mqttClient); + } + return 1; #else