Add ifindex when check duplicated message
authorbg.chun <bg.chun@samsung.com>
Wed, 2 Nov 2016 07:55:41 +0000 (16:55 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Tue, 8 Nov 2016 05:21:00 +0000 (05:21 +0000)
Add ifindex when the function CADropSecondMessage() compare
duplicated message with message ID, token, address family

Change-Id: Ida49daa92ea4e0e5e099c77aeacbad55da308d2f
Signed-off-by: bg.chun <bg.chun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13943
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/src/camessagehandler.c

index 8f455e6..5c8a353 100644 (file)
@@ -495,6 +495,7 @@ typedef struct
     uint16_t messageId;
     char token[CA_MAX_TOKEN_LEN];
     uint8_t tokenLength;
+    uint32_t ifindex;
 } CAHistoryItem_t;
 
 typedef struct
index c330d59..0bed916 100644 (file)
@@ -698,7 +698,7 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui
     {
         CAHistoryItem_t *item = &(history->items[i]);
         if (id == item->messageId && tokenLength == item->tokenLength
-            && memcmp(item->token, token, tokenLength) == 0)
+            && ep->ifindex == item->ifindex && memcmp(item->token, token, tokenLength) == 0)
         {
             if ((familyFlags ^ item->flags) == CA_IPFAMILY_MASK)
             {
@@ -712,6 +712,7 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui
 
     history->items[history->nextIndex].flags = familyFlags;
     history->items[history->nextIndex].messageId = id;
+    history->items[history->nextIndex].ifindex = ep->ifindex;
     if (token && tokenLength)
     {
         memcpy(history->items[history->nextIndex].token, token, tokenLength);