Cancel all command when MQTT command failed (#814)

* Use MQTT Agent provided API, MQTTAgent_CancelAll, to clear queue when
  MQTT command failed.
This commit is contained in:
chinglee-iot 2022-05-17 08:37:37 +08:00 committed by GitHub
parent ad88de61d0
commit 5a2c56bf9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -2132,7 +2132,7 @@ static void prvMQTTAgentTask(void* pParam)
xMQTTStatus = MQTTAgent_CommandLoop(&xGlobalMqttAgentContext);
/* Clear Agent queue so that no any pending MQTT operations are processed. */
xQueueReset(xCommandQueue.queue);
MQTTAgent_CancelAll(&xGlobalMqttAgentContext);
/* Success is returned for application initiated disconnect or termination. The socket will also be disconnected by the caller. */
if (xMQTTStatus != MQTTSuccess)

View file

@ -1725,7 +1725,7 @@ static void prvMQTTAgentTask(void* pParam)
xMQTTStatus = MQTTAgent_CommandLoop(&xGlobalMqttAgentContext);
/* Clear Agent queue so that no any pending MQTT operations are processed. */
xQueueReset(xCommandQueue.queue);
MQTTAgent_CancelAll(&xGlobalMqttAgentContext);
/* Success is returned for application initiated disconnect or termination. The socket will also be disconnected by the caller. */
if (xMQTTStatus != MQTTSuccess)