- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello vik86
As a follow on to this thread: Issue with MQTT reconnecting to broker if wifi connection goes down
I'm also trying to make the same logic work. When disconnected, I deinit and free mqtt_object and do some other stuff. Then I recreate it and try to connect. However there seems to be a memory leak, I think it might be related with the linked list that the session creates. Is there a way to easily delete all the data related to mqtt connection? Here is the code I used for deinit :
mqtt_connection_t *conn = (mqtt_connection_t*) mqtt_object;
wiced_rtos_deregister_timed_event( &conn->heartbeat.timer );
mqtt_connection_deinit(conn);
wiced_mqtt_deinit(mqtt_object);
free( mqtt_object );
Thanks
- Tags:
- mqtt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ mqtt_manager.c : bottom of wiced_result_t mqtt_manager( mqtt_event_t event, void *args, mqtt_connection_t *conn )
case MQTT_EVENT_CONNECTION_CLOSE:
{
/* TODO : add implementations here, or add fall-through to default */
mqtt_manager_heartbeat_recv_reset( &conn->heartbeat );
mqtt_connection_deinit(conn);
}
will this help?