Fixed the start adapter bug in ip/tcp adapter. (IOT-753/ IOT-453)
authorAshok Channa <ashok.channa@samsung.com>
Fri, 25 Sep 2015 01:01:16 +0000 (10:01 +0900)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Fri, 25 Sep 2015 18:21:56 +0000 (18:21 +0000)
After multiple terminate initialization, CASendRequest API
is not working. because we didn't set the start flag with false
after stopping adapter. Both JIRA issues are related.

Change-Id: If855c4f689ce6979ae13591f2d4048113148d150
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Signed-off-by: Ashok Channa <ashok.channa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3069
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/connectivity/src/ip_adapter/caipadapter.c
resource/csdk/connectivity/src/ip_adapter/caipserver.c
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c

index 2528db8..8a50301 100644 (file)
@@ -420,6 +420,8 @@ CAResult_t CAStopIP()
 
     CAIPStopNetworkMonitor();
     CAIPStopServer();
+    //Re-initializing the Globals to start them again
+    CAInitializeIPGlobals();
 
     OIC_LOG(DEBUG, TAG, "OUT");
     return CA_STATUS_OK;
index a463c83..d3f97ff 100644 (file)
@@ -498,6 +498,7 @@ void CAIPStopServer()
 {
     OIC_LOG(DEBUG, TAG, "IN");
 
+    caglobals.ip.started = false;
     caglobals.ip.terminate = true;
 
     if (caglobals.ip.shutdownFds[1] != -1)
index 37657fb..64db605 100644 (file)
@@ -173,7 +173,7 @@ static void CATCPDisconnectAll()
         }
     }
     u_arraylist_destroy(caglobals.tcp.svrlist);
-
+    caglobals.tcp.svrlist = NULL;
     ca_mutex_unlock(g_mutexObjectList);
 
     OIC_LOG(DEBUG, TAG, "OUT");
@@ -575,6 +575,8 @@ CAResult_t CATCPStartServer(const ca_thread_pool_t threadPool)
 
     caglobals.tcp.started = true;
 
+    g_threadCounts = CA_TCP_DEFAULT_THREAD_COUNTS;
+
     return CA_STATUS_OK;
 }
 
@@ -587,6 +589,7 @@ void CATCPStopServer()
 
     // set terminate flag
     caglobals.tcp.terminate = true;
+    caglobals.tcp.started = false;
 
     ca_cond_wait(g_condObjectList, g_mutexObjectList);