MQTTs: connect after disconnect

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

MQTTs: connect after disconnect

Giuseppe Modugno
First MQTTs connection works fine. However I noticed that the second
connection attempt after a disconnection doesn't work.

For example, if I unplug Ethernet cable, MQTT client detects connection
failure (because of lacks of PINGRESP from server) and disconnect. The
MQTT connection callback is normally called with
status=MQTT_CONNECT_TIMEOUT, I fire a 3s timeout. In the timer callback,
I call again mqtt_client_connect(), this time without success. As you
can understand, I need to keep the connection to server up.

I'm investigating what happens and I found something strange. During
mqtt_client_connect() many allocations were made with altcp_tls_new().
However I couldn't find where exactly those allocations are freed at
disconnection time. I think I have some memory allocation problem during
the second attempt, because the memory allocated during first connection
isn't freed.

Another strange thing I noticed. Is it sure that mqtt_disconnect()
shouldn't call connection callback registered in mqtt_client_connect()?

lwip-users mailing list
[hidden email]