The situation arises when there was a connection to the broker and then the broker disconnected. After about 15 minutes, program stops in the assert function. Tell me the reason for the error. Stopping the broker should not lead to a shutdown. I attach parts of the log and the corresponding code
Are you still running MQTTAgent_CommandLoop even whilst disconnected? It returns an error on connection loss, so you need to make sure you’re re-running it even whilst not connected if you want to keep pushing commands to it.
If the agent isn’t consuming commands, the queue is going to fill up and depending on the size of the queue and pool, you’re may run out of commands too (which is what “No command structure available.” means).
Thank you for reply.
The size is - #define MQTT_COMMAND_CONTEXTS_POOL_SIZE ( 10U )
I used the MQTTagent example code as a basis. As I understand it, there is a problem with determining the state. As I wroteFORUM POST earlier, the MQTT_CheckConnectStatus(pMQTTContext ) function does not work correctly if the link to the Internet remains, but it is the broker’s server that is disconnected. The problem does not occur if you physically pull out the ethernet cable, then the cycle stops
From my understanding, this aspect appears to be more closely related to the application layer of the system. Given that context, I believe it would be appropriate to proceed with updating this part of code.