Fix for DTLS message failure when previous not closed properly
authorjnashok <jn.ashok@samsung.com>
Mon, 4 May 2015 07:17:14 +0000 (16:17 +0900)
committerSachin Agrawal <sachin.agrawal@intel.com>
Fri, 8 May 2015 16:55:52 +0000 (16:55 +0000)
This fixes JIRA issue IOT-417.  When a previous DTLS session was not
properly closed, DTLS messaging would fail.  This patch ensures that
DTLS sessions are properly closed.

Change-Id: I0483253cad313c7596ae30d9624db57c072417d8
Signed-off-by: jnashok <jn.ashok@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/889
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/connectivity/src/ip_adapter/caipadapter.c

index 667f958..faf147a 100644 (file)
@@ -675,6 +675,10 @@ CAResult_t CAStopIP()
 {
     OIC_LOG(DEBUG, IP_ADAPTER_TAG, "IN");
 
+#ifdef __WITH_DTLS__
+    CAAdapterNetDtlsDeInit();
+#endif
+
     // Stop IP network monitor
     CAIPStopNetworkMonitor();
 
@@ -695,14 +699,14 @@ void CATerminateIP()
 {
     OIC_LOG(DEBUG, IP_ADAPTER_TAG, "IN");
 
+    // Stop IP adapter
+    CAStopIP();
+
 #ifdef __WITH_DTLS__
     CADTLSSetAdapterCallbacks(NULL, NULL, DTLS_IP);
-    CAAdapterNetDtlsDeInit();
 #endif
 
     CAIPSetPacketReceiveCallback(NULL);
-    // Stop IP adapter
-    CAStopIP();
 
     // Terminate IP server
     CAIPTerminateServer();