Skip to content

Commit

Permalink
Prevent messages on /update/accepted from incrementing shadowJsonVers…
Browse files Browse the repository at this point in the history
…ionNum

Fixes #71
  • Loading branch information
vareddy authored and Gordon Wang committed Apr 20, 2018
1 parent cbeb793 commit 4f68356
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aws_iot_shadow_records.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ static void topicNameFromThingAndAction(char *pTopic, const char *pThingName, Sh
}
}

static bool isAckForMyThingName(const char *pTopicName) {
static bool isValidShadowVersionUpdate(const char *pTopicName) {
if(strstr(pTopicName, myThingName) != NULL &&
((strstr(pTopicName, "get/accepted") != NULL) || (strstr(pTopicName, "update/accepted") != NULL) ||
((strstr(pTopicName, "get/accepted") != NULL) ||
(strstr(pTopicName, "delta") != NULL))) {
return true;
}
Expand Down Expand Up @@ -201,7 +201,7 @@ static void AckStatusCallback(AWS_IoT_Client *pClient, char *topicName, uint16_t
return;
}

if(isAckForMyThingName(topicName)) {
if(isValidShadowVersionUpdate(topicName)) {
uint32_t tempVersionNumber = 0;
if(extractVersionNumber(shadowRxBuf, pJsonHandler, tokenCount, &tempVersionNumber)) {
if(tempVersionNumber > shadowJsonVersionNum) {
Expand Down

0 comments on commit 4f68356

Please sign in to comment.