# Disconnecting the broker leads to an error

**URL:** <https://forums.freertos.org/t/disconnecting-the-broker-leads-to-an-error/21736>\
**Category:** Libraries\
**Created:** [October 29, 2024, 3:26pm UTC](https://forums.freertos.org/t/disconnecting-the-broker-leads-to-an-error/21736 "2024-10-29T15:26:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pistoletov1974](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/pistoletov1974/32/4554_2.png) [@pistoletov1974](https://forums.freertos.org/u/pistoletov1974)\
**Post date:** [October 29, 2024, 4:03pm UTC](https://forums.freertos.org/t/disconnecting-the-broker-leads-to-an-error/21736/3 "2024-10-29T16:03:32Z")

</div>

> [@jfx](#):
>
> Are you still running `MQTTAgent_CommandLoop` even whilst disconnected?

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 wrote[FORUM POST](https://forums.freertos.org/t/global-varaiable-of-mqtt-broker-state/21569/11) 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

---

_[View the full topic](https://forums.freertos.org/t/disconnecting-the-broker-leads-to-an-error/21736)._
