Fix bug allowing an infinite subscribe loop (#348)

* Reset flag in each iteration of subscribe loop
This commit is contained in:
Muneeb Ahmed
2020-10-16 10:51:23 -07:00
committed by GitHub
parent d47a28aff7
commit 806d51caf0
5 changed files with 15 additions and 0 deletions

View File

@@ -659,6 +659,9 @@ static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext )
xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
configASSERT( xResult == MQTTSuccess );
/* Reset flag before checking suback responses. */
xFailedSubscribeToTopic = false;
/* Check if recent subscription request has been rejected. #xTopicFilterContext is updated
* in the event callback to reflect the status of the SUBACK sent by the broker. It represents
* either the QoS level granted by the server upon subscription, or acknowledgement of

View File

@@ -713,6 +713,9 @@ static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext )
xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexampleRECEIVE_LOOP_TIMEOUT_MS );
configASSERT( xResult == MQTTSuccess );
/* Reset flag before checking suback responses. */
xFailedSubscribeToTopic = false;
/* Check if the recent subscription request has been rejected. #xTopicFilterContext
* is updated in the event callback to reflect the status of the SUBACK
* sent by the broker. It represents either the QoS level granted by the

View File

@@ -779,6 +779,9 @@ static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext )
xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
configASSERT( xResult == MQTTSuccess );
/* Reset flag before checking suback responses. */
xFailedSubscribeToTopic = false;
/* Check if recent subscription request has been rejected. #xTopicFilterContext is updated
* in the event callback to reflect the status of the SUBACK sent by the broker. It represents
* either the QoS level granted by the server upon subscription, or acknowledgement of

View File

@@ -605,6 +605,9 @@ static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext )
xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
configASSERT( xResult == MQTTSuccess );
/* Reset flag before checking suback responses. */
xFailedSubscribeToTopic = false;
/* Check if recent subscription request has been rejected. #xTopicFilterContext is updated
* in the event callback to reflect the status of the SUBACK sent by the broker. It represents
* either the QoS level granted by the server upon subscription, or acknowledgement of

View File

@@ -843,6 +843,9 @@ static void prvMQTTSubscribeWithBackoffRetries( Socket_t xMQTTSocket )
* processing function everywhere to highlight this fact. */
prvMQTTProcessIncomingPacket( xMQTTSocket );
/* Reset flag before checking suback responses. */
xFailedSubscribeToTopic = false;
/* Check if recent subscription request has been rejected. #xTopicFilterContext is updated
* in the event callback to reflect the status of the SUBACK sent by the broker. It represents
* either the QoS level granted by the server upon subscription, or acknowledgement of