I’m using the AWS IoT Device packet included in Keil, with the MQTT library:
I’ve modified the iot_demo_mqtt.c and iot_demo.c examples to make it connect to a mosquitto broker, using TLS. It works fine and makes all the publications and subscriptions.
But when finishing there is some code that cleans the connection that doesn’t seems to work:
/* Clean up the network stack if initialized. */
if( networkInitialized == true )
{
IotDemoNetwork_Cleanup();
}
/* Clean up the SDK if initialized. */
if( sdkInitialized == true )
{
IotSdk_Cleanup();
}
IotDemoNetwork_Cleanup() don’t returns and if I comment it, IotSdk_Cleanup dont works also, jumps to prvTaskExitError().
IotDemoNetwork_Cleanup calls to IotNetworkMbedtls_Cleanup, seems that can’t close correctly the TLS connection.
I want to be able to recover from a disconnection, but if I try to reconnect again without disconnecting and cleaning everything there are some network and tasks related errors.