I’m calling IotMqtt_Connect() (which connects) and then IotMqtt_Disconnect() (which hangs). I traced this to IotNetworkAfr_Close and IotNetworkAfr_Destroy, both of which call xEventGroupWaitBits on _FLAG_RECEIVE_TASK_EXITED with xClearOnExit set to pdTRUE.
As I understand it, the second call (from …Destroy) waits forever, because the previous call (from …Close) cleared the flag. Can this be the case?
Alternatively, I need to be doing something, maybe in the MQTT onDisconnect callback? But I havn’t been able to find much inspiration in the examples provided.
Bottom line, what am I doing wrong? Or what is MQTT doing wrong?
for the same reason – IotNetworkAfr_Close waited for _FLAG_RECEIVE_TASK_EXITED with xClearOnExit == TRUE, so _FLAG_RECEIVE_TASK_EXITED is no longer set.