tuanpmt / esp32-mqtt

ESP32 MQTT sample project for
https://github.com/tuanpmt/espmqtt
Apache License 2.0
178 stars 51 forks source link

mqtt_stop() sometimes does not work. #21

Open shirish47 opened 7 years ago

shirish47 commented 7 years ago

I am trying to subscribe to topic but when it fails after some time I retry and if it fails I stop mqtt to disconnect from broker but it does not.

[MQTT INFO] Connected to MQTT broker, create sending thread before call connected callback
[MQTT INFO] mqtt_sending_task
I (39213) BYTELENSCLIENT: Connected to BROKER. 

[MQTT INFO] Queue subscribe, topic"topic_infoRX", id: 1
[MQTT INFO] Sending...38 bytes
[MQTT INFO] Queue subscribe, topic"topic_listRX", id: 2
[MQTT INFO] Sending...38 bytes
[MQTT INFO] mqtt_start_receive_schedule
I (41803) wifi: active cnt: 5
I (51803) wifi: send null to keep active
I (61803) wifi: send null to keep active
I (71803) wifi: send null to keep active
I (71873) GATTC_DEMO: Ticker: conn: 0 ,Noti: 0, scan: 0
I (71873) GATTC_DEMO: Ticker: wificon: 1, mqttcon: 1, mqttsub: 0
I (71873) GATTC_DEMO: Ticker: MQTT broker not Subscribed, retrying 1    <-- here I do mqtt_stop 
I (81803) wifi: send null to keep active
I (91803) wifi: send null to keep active
[MQTT INFO] Sending pingreq
I (101803) wifi: active cnt: 1
I (106873) GATTC_DEMO: Ticker: conn: 0 ,Noti: 0, scan: 0
I (106873) GATTC_DEMO: Ticker: wificon: 1, mqttcon: 0, mqttsub: 0
I (106873) GATTC_DEMO: Ticker: MQTT broker not Connected, retrying 2 <-- this is just flag MQTT not disconnect from broker.
I (111803) wifi: send null to keep active
I (121803) wifi: send null to keep active
I (131803) wifi: send null to keep active
I (141803) wifi: send null to keep active
I (141873) GATTC_DEMO: Ticker: conn: 0 ,Noti: 0, scan: 0
I (141873) GATTC_DEMO: Ticker: wificon: 1, mqttcon: 0, mqttsub: 0
I (141873) GATTC_DEMO: Ticker: MQTT broker not Connected, retrying 3
I (151813) wifi: send null to keep active
[MQTT INFO] Sending pingreq
I (161813) wifi: active cnt: 1