Remove keepalive entry before sending the request for disconnection.
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Mon, 22 Aug 2016 06:17:30 +0000 (15:17 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Fri, 26 Aug 2016 05:27:54 +0000 (05:27 +0000)
Remove keepalive entry before sending the request for disconnection.

Change-Id: Ia56436309a46ef1e2e690cbd7425a5d7284ad60c
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10715
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: jihwan seo <jihwan.seo@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/stack/src/oickeepalive.c

index 09fc6a7..a521f87 100644 (file)
@@ -549,8 +549,15 @@ OCStackResult SendDisconnectMessage(const KeepAliveEntry_t *entry)
      * Send empty message to disconnect a connection.
      * If CA get the empty message from RI, CA will disconnect a connection.
      */
+
+    OCStackResult result = RemoveKeepAliveEntry(&entry->remoteAddr);
+    if (result != OC_STACK_OK)
+    {
+        return result;
+    }
+
     CARequestInfo_t requestInfo = { .method = CA_PUT };
-    CAResult_t result = CASendRequest(&entry->remoteAddr, &requestInfo);
+    result = CASendRequest(&entry->remoteAddr, &requestInfo);
     return CAResultToOCResult(result);
 }
 
@@ -744,7 +751,6 @@ void HandleKeepAliveConnCB(const CAEndpoint_t *endpoint, bool isConnected)
         OCStackResult result = RemoveKeepAliveEntry(endpoint);
         if(result != OC_STACK_OK)
         {
-            OIC_LOG(ERROR, TAG, "Failed to remove entry");
             return;
         }
     }