Update snapshot(2017-11-02)
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / tcp_adapter / catcpadapter.c
index 67905f6..ac6f6d7 100644 (file)
@@ -471,17 +471,32 @@ CAResult_t CATCPDisconnectSession(const CAEndpoint_t *endpoint)
     if (CA_STATUS_OK != res)
     {
         OIC_LOG(ERROR, TAG, "failed to close TLS session");
+        res = CAQueueingThreadClearContextData(g_sendQueueHandle,
+                                               CAClearQueueEndpointDataContext,
+                                               endpoint);
+        if (CA_STATUS_OK != res)
+        {
+            OIC_LOG(ERROR, TAG, "failed to clear context data");
+        }
+
         return res;
     }
 #endif
+
     res = CASearchAndDeleteTCPSession(endpoint);
     if (CA_STATUS_OK != res)
     {
         OIC_LOG(ERROR, TAG, "failed to close TCP session");
     }
+
     res = CAQueueingThreadClearContextData(g_sendQueueHandle,
                                            CAClearQueueEndpointDataContext,
                                            endpoint);
+    if (CA_STATUS_OK != res)
+    {
+        OIC_LOG(ERROR, TAG, "failed to clear context data");
+    }
+
     return res;
 }