Fix bug for copy of provider informations.
authorKIM JungYong <jyong2.kim@samsung.com>
Mon, 22 Aug 2016 08:05:08 +0000 (17:05 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 23 Aug 2016 12:45:56 +0000 (12:45 +0000)
When provider information was stored,
storage module copy whole of provider connections,
but first pointer of connection information was wrongly redefine with next connection information.
For the reason, first connection information was ignored.
In this patch wrongly calculation of pointer was fixed.

Change-Id: Ic91abd458979c2b113e641b3d9c28e6894dd5b7f
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10723
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/consumer/NSConsumerCommon.c

index 3b71550..ea12a52 100644 (file)
@@ -320,20 +320,26 @@ NSProviderConnectionInfo * NSCopyProviderConnections(NSProviderConnectionInfo *
 
     NSProviderConnectionInfo * retInfo = NSCreateProviderConnections(tmp->addr);
     NS_VERIFY_NOT_NULL(retInfo, NULL);
+    retInfo->messageHandle = tmp->messageHandle;
+    retInfo->syncHandle = tmp->syncHandle;
+    retInfo->isCloudConnection = tmp->isCloudConnection;
+    retInfo->isSubscribing = tmp->isSubscribing;
+
     tmp = tmp->next;
     NSProviderConnectionInfo * copyInfo = retInfo;
 
     while(tmp)
     {
-        copyInfo = NSCreateProviderConnections(tmp->addr);
-        NS_VERIFY_NOT_NULL(copyInfo, NULL);
+        NSProviderConnectionInfo * tmpInfo = NSCreateProviderConnections(tmp->addr);
+        NS_VERIFY_NOT_NULL(tmpInfo, NULL);
 
-        copyInfo->messageHandle = tmp->messageHandle;
-        copyInfo->syncHandle = tmp->syncHandle;
-        copyInfo->isCloudConnection = tmp->isCloudConnection;
-        copyInfo->isSubscribing = tmp->isSubscribing;
+        tmpInfo->messageHandle = tmp->messageHandle;
+        tmpInfo->syncHandle = tmp->syncHandle;
+        tmpInfo->isCloudConnection = tmp->isCloudConnection;
+        tmpInfo->isSubscribing = tmp->isSubscribing;
         tmp = tmp->next;
-        copyInfo = copyInfo->next;
+        copyInfo->next = tmpInfo;
+        copyInfo = tmpInfo;
     }
 
     return retInfo;
@@ -570,6 +576,7 @@ bool NSOCResultToSuccess(OCStackResult ret)
         case OC_STACK_OK:
         case OC_STACK_RESOURCE_CREATED:
         case OC_STACK_RESOURCE_DELETED:
+        case OC_STACK_PRESENCE_STOPPED:
         case OC_STACK_CONTINUE:
         case OC_STACK_RESOURCE_CHANGED:
             return true;