Added error callback when adapter is terminated
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Thu, 10 Nov 2016 09:39:24 +0000 (18:39 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 14 Nov 2016 08:32:10 +0000 (08:32 +0000)
If application try to send data when adapter is terminated,
Error message should be delivered to application layer.

Change-Id: Iec02116e864fb8667570c67982f44838d74f84a9
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14181
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c

index d31d349..15bdf59 100644 (file)
@@ -505,6 +505,14 @@ void CATCPSendDataThread(void *threadData)
         return;
     }
 
+    if (caglobals.tcp.terminate)
+    {
+        OIC_LOG(DEBUG, TAG, "Adapter is not enabled");
+        CATCPErrorHandler(tcpData->remoteEndpoint, tcpData->data, tcpData->dataLen,
+                          CA_SEND_FAILED);
+        return;
+    }
+
     if (tcpData->isMulticast)
     {
         //Processing for sending multicast