Fixed CA logging issues.
authorDoug Hudson <douglas.hudson@intel.com>
Mon, 16 Mar 2015 19:24:30 +0000 (15:24 -0400)
committerSashi Penta <sashi.kumar.penta@intel.com>
Thu, 19 Mar 2015 22:34:54 +0000 (22:34 +0000)
- Fixed incorrect use of DEBUG label for logging error conditions.
Mod done as part of fixing unresolved CA issues.

- Fixed incorrect use of OIC_LOG_V in connectivity/src and
for single thread files that might affect Arduino stack size.
This issue was not listed in CA review.

Change-Id: I38cc2310bf3a7c91d0dd8b457a237c7f930e6646
Signed-off-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/479
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: Sashi Penta <sashi.kumar.penta@intel.com>
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/connectivity/src/camessagehandler_singlethread.c
resource/csdk/connectivity/src/caqueueingthread.c
resource/csdk/connectivity/src/caretransmission.c

index 75ecb61..7e9de74 100644 (file)
@@ -43,7 +43,7 @@
 #define TAG PCF("CA")
 #define SINGLE_HANDLE
 
-#define CA_MEMORY_ALLOC_CHECK(arg) { if (arg == NULL) {OIC_LOG_V(ERROR, TAG, "Out of memory"); \
+#define CA_MEMORY_ALLOC_CHECK(arg) { if (arg == NULL) {OIC_LOG(ERROR, TAG, "Out of memory"); \
 goto memory_error_exit;} }
 
 #define MAX_THREAD_POOL_SIZE    20
@@ -159,7 +159,7 @@ static void CAReceiveThreadProcess(void *threadData)
 
     if (data == NULL)
     {
-        OIC_LOG(DEBUG, TAG, "thread data error!!");
+        OIC_LOG(ERROR, TAG, "thread data error!!");
         return;
     }
 
@@ -215,7 +215,7 @@ static void CASendThreadProcess(void *threadData)
 
         if (data->requestInfo != NULL)
         {
-            OIC_LOG_V(DEBUG, TAG, "requestInfo is available..");
+            OIC_LOG(DEBUG, TAG, "requestInfo is available..");
 
             pdu = (coap_pdu_t *) CAGeneratePdu(data->remoteEndpoint->resourceUri,
                                                data->requestInfo->method,
@@ -223,7 +223,7 @@ static void CASendThreadProcess(void *threadData)
         }
         else if (data->responseInfo != NULL)
         {
-            OIC_LOG_V(DEBUG, TAG, "responseInfo is available..");
+            OIC_LOG(DEBUG, TAG, "responseInfo is available..");
 
             pdu = (coap_pdu_t *) CAGeneratePdu(data->remoteEndpoint->resourceUri,
                                                data->responseInfo->result,
@@ -472,7 +472,7 @@ static void CANetworkChangedCallback(CALocalConnectivity_t *info, CANetworkStatu
 
 void CAHandleRequestResponseCallbacks()
 {
-    OIC_LOG_V(DEBUG, TAG, "CAHandleRequestResponseCallbacks IN");
+    OIC_LOG(DEBUG, TAG, "CAHandleRequestResponseCallbacks IN");
 
     // parse the data and call the callbacks.
     // #1 parse the data
@@ -532,13 +532,13 @@ void CAHandleRequestResponseCallbacks()
     }
 
     OICFree(rep);
-    OIC_LOG_V(DEBUG, TAG, "CAHandleRequestResponseCallbacks OUT");
+    OIC_LOG(DEBUG, TAG, "CAHandleRequestResponseCallbacks OUT");
 }
 
 CAResult_t CADetachRequestMessage(const CARemoteEndpoint_t *object,
                                   const CARequestInfo_t *request)
 {
-    OIC_LOG_V(DEBUG, TAG, "CADetachRequestMessage");
+    OIC_LOG(DEBUG, TAG, "CADetachRequestMessage");
 
     if (object == NULL || request == NULL)
     {
@@ -590,7 +590,7 @@ CAResult_t CADetachRequestToAllMessage(const CAGroupEndpoint_t *object,
                                        const CARequestInfo_t *request)
 {
     // ToDo
-    OIC_LOG_V(DEBUG, TAG, "CADetachRequestToAllMessage");
+    OIC_LOG(DEBUG, TAG, "CADetachRequestToAllMessage");
 
 
     if (object == NULL || request == NULL)
@@ -642,7 +642,7 @@ memory_error_exit:
 CAResult_t CADetachResponseMessage(const CARemoteEndpoint_t *object,
                                    const CAResponseInfo_t *response)
 {
-    OIC_LOG_V(DEBUG, TAG, "CADetachResponseMessage");
+    OIC_LOG(DEBUG, TAG, "CADetachResponseMessage");
 
     if (object == NULL || response == NULL)
     {
@@ -777,7 +777,7 @@ memory_error_exit:
 void CASetRequestResponseCallbacks(CARequestCallback ReqHandler,
                                    CAResponseCallback RespHandler)
 {
-    OIC_LOG_V(DEBUG, TAG, "set request, response handler callback.");
+    OIC_LOG(DEBUG, TAG, "set request, response handler callback.");
 
     g_requestHandler = ReqHandler;
     g_responseHandler = RespHandler;
@@ -796,7 +796,7 @@ CAResult_t CAInitializeMessageHandler()
 
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(ERROR, TAG, "thread pool initialize error.");
+        OIC_LOG(ERROR, TAG, "thread pool initialize error.");
         return res;
     }
 
@@ -809,7 +809,7 @@ CAResult_t CAInitializeMessageHandler()
 
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(ERROR, TAG, "thread start error(send thread).");
+        OIC_LOG(ERROR, TAG, "thread start error(send thread).");
         u_thread_pool_free(g_threadPoolHandle);
         g_threadPoolHandle = NULL;
         return res;
@@ -825,7 +825,7 @@ CAResult_t CAInitializeMessageHandler()
 
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread start error(receive thread).");
+        OIC_LOG(ERROR, TAG, "thread start error(receive thread).");
         return res;
     }
 #endif
@@ -839,7 +839,7 @@ CAResult_t CAInitializeMessageHandler()
 
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(ERROR, TAG, "thread start error(retransmission thread).");
+        OIC_LOG(ERROR, TAG, "thread start error(retransmission thread).");
         return res;
     }
 
@@ -905,6 +905,6 @@ void CATerminateMessageHandler()
     // terminate interface adapters by controller
     CATerminateAdapters();
 
-    OIC_LOG_V(DEBUG, TAG, "message handler termination is complete!");
+    OIC_LOG(DEBUG, TAG, "message handler termination is complete!");
 }
 
index 4e0082d..1321eca 100644 (file)
@@ -37,7 +37,7 @@
 
 #define TAG "CAMH_ST"
 
-#define CA_MEMORY_ALLOC_CHECK(arg) { if (arg == NULL) {OIC_LOG(DEBUG, TAG, "Out of memory");\
+#define CA_MEMORY_ALLOC_CHECK(arg) { if (arg == NULL) {OIC_LOG(ERROR, TAG, "Out of memory");\
     goto memory_error_exit;} }
 
 #define CA_MAX_RT_ARRAY_SIZE    3
index 2946208..57bb165 100644 (file)
 
 static void CAQueueingThreadBaseRoutine(void *threadValue)
 {
-    OIC_LOG_V(DEBUG, TAG, "message handler main thread start..");
+    OIC_LOG(DEBUG, TAG, "message handler main thread start..");
 
     CAQueueingThread_t *thread = (CAQueueingThread_t *) threadValue;
 
     if (thread == NULL)
     {
-        OIC_LOG_V(ERROR, TAG, "thread data passing error!!");
+        OIC_LOG(ERROR, TAG, "thread data passing error!!");
 
         return;
     }
@@ -52,12 +52,12 @@ static void CAQueueingThreadBaseRoutine(void *threadValue)
         // if queue is empty, thread will wait
         if (u_queue_get_size(thread->dataQueue) <= 0)
         {
-            OIC_LOG_V(DEBUG, TAG, "wait..");
+            OIC_LOG(DEBUG, TAG, "wait..");
 
             // wait
             u_cond_wait(thread->threadCond, thread->threadMutex);
 
-            OIC_LOG_V(DEBUG, TAG, "wake up..");
+            OIC_LOG(DEBUG, TAG, "wake up..");
         }
 
         // mutex unlock
@@ -115,7 +115,7 @@ static void CAQueueingThreadBaseRoutine(void *threadValue)
 
     u_cond_signal(thread->threadCond);
 
-    OIC_LOG_V(DEBUG, TAG, "message handler main thread end..");
+    OIC_LOG(DEBUG, TAG, "message handler main thread end..");
 }
 
 CAResult_t CAQueueingThreadInitialize(CAQueueingThread_t *thread, u_thread_pool_t handle,
@@ -123,17 +123,17 @@ CAResult_t CAQueueingThreadInitialize(CAQueueingThread_t *thread, u_thread_pool_
 {
     if (thread == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (handle == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread pool handle is empty..");
+        OIC_LOG(ERROR, TAG, "thread pool handle is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "thread initialize..");
+    OIC_LOG(DEBUG, TAG, "thread initialize..");
 
     // set send thread data
     thread->threadPool = handle;
@@ -151,19 +151,19 @@ CAResult_t CAQueueingThreadStart(CAQueueingThread_t *thread)
 {
     if (thread == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (thread->threadPool == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread pool handle is empty..");
+        OIC_LOG(ERROR, TAG, "thread pool handle is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (false == thread->isStop) //Queueing thread already running
     {
-        OIC_LOG_V(DEBUG, TAG, "queueing thread already running..");
+        OIC_LOG(DEBUG, TAG, "queueing thread already running..");
         return CA_STATUS_OK;
     }
 
@@ -177,7 +177,7 @@ CAResult_t CAQueueingThreadStart(CAQueueingThread_t *thread)
                                             thread);
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread pool add task error(send thread).");
+        OIC_LOG(ERROR, TAG, "thread pool add task error(send thread).");
     }
 
     return res;
@@ -187,13 +187,13 @@ CAResult_t CAQueueingThreadAddData(CAQueueingThread_t *thread, void *data, uint3
 {
     if (thread == NULL)
     {
-        OIC_LOG_V(ERROR, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (data == NULL || size == 0)
     {
-        OIC_LOG_V(ERROR, TAG, "data is empty..");
+        OIC_LOG(ERROR, TAG, "data is empty..");
 
         return CA_STATUS_FAILED;
     }
@@ -203,7 +203,7 @@ CAResult_t CAQueueingThreadAddData(CAQueueingThread_t *thread, void *data, uint3
 
     if (message == NULL)
     {
-        OIC_LOG_V(ERROR, TAG, "memory error!!");
+        OIC_LOG(ERROR, TAG, "memory error!!");
         return CA_MEMORY_ALLOC_FAILED;
     }
 
@@ -229,11 +229,11 @@ CAResult_t CAQueueingThreadDestroy(CAQueueingThread_t *thread)
 {
     if (thread == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "thread destroy..");
+    OIC_LOG(DEBUG, TAG, "thread destroy..");
 
     u_mutex_free(thread->threadMutex);
     thread->threadMutex = NULL;
@@ -247,11 +247,11 @@ CAResult_t CAQueueingThreadStop(CAQueueingThread_t *thread)
 {
     if (thread == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "thread stop request!!");
+    OIC_LOG(DEBUG, TAG, "thread stop request!!");
 
     if (!thread->isStop)
     {
index a63b3e4..48b2cfa 100644 (file)
@@ -153,7 +153,7 @@ static void CACheckRetransmissionList(CARetransmission_t *context)
             }
             else
             {
-                OIC_LOG_V(ERROR, TAG, "arraylist remove error");
+                OIC_LOG(ERROR, TAG, "arraylist remove error");
             }
 
         }
@@ -165,13 +165,13 @@ static void CACheckRetransmissionList(CARetransmission_t *context)
 
 static void CARetransmissionBaseRoutine(void *threadValue)
 {
-    OIC_LOG_V(DEBUG, TAG, "retransmission main thread start..");
+    OIC_LOG(DEBUG, TAG, "retransmission main thread start..");
 
     CARetransmission_t *context = (CARetransmission_t *) threadValue;
 
     if (context == NULL)
     {
-        OIC_LOG_V(ERROR, TAG, "thread data passing error!!");
+        OIC_LOG(ERROR, TAG, "thread data passing error!!");
 
         return;
     }
@@ -184,12 +184,12 @@ static void CARetransmissionBaseRoutine(void *threadValue)
         if (u_arraylist_length(context->dataList) <= 0)
         {
             // if list is empty, thread will wait
-            OIC_LOG_V(DEBUG, TAG, "wait..there is no retransmission data.");
+            OIC_LOG(DEBUG, TAG, "wait..there is no retransmission data.");
 
             // wait
             u_cond_wait(context->threadCond, context->threadMutex);
 
-            OIC_LOG_V(DEBUG, TAG, "wake up..");
+            OIC_LOG(DEBUG, TAG, "wake up..");
         }
         else
         {
@@ -216,7 +216,7 @@ static void CARetransmissionBaseRoutine(void *threadValue)
 
     u_cond_signal(context->threadCond);
 
-    OIC_LOG_V(DEBUG, TAG, "retransmission main thread end..");
+    OIC_LOG(DEBUG, TAG, "retransmission main thread end..");
 
 }
 
@@ -226,17 +226,17 @@ CAResult_t CARetransmissionInitialize(CARetransmission_t *context, u_thread_pool
 {
     if (context == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread instance is empty..");
+        OIC_LOG(ERROR, TAG, "thread instance is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (handle == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread pool handle is empty..");
+        OIC_LOG(ERROR, TAG, "thread pool handle is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "thread initialize..");
+    OIC_LOG(DEBUG, TAG, "thread initialize..");
 
     memset(context, 0, sizeof(CARetransmission_t));
 
@@ -270,13 +270,13 @@ CAResult_t CARetransmissionStart(CARetransmission_t *context)
 {
     if (context == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "context is empty..");
+        OIC_LOG(ERROR, TAG, "context is empty..");
         return CA_STATUS_FAILED;
     }
 
     if (context->threadPool == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "thread pool handle is empty..");
+        OIC_LOG(ERROR, TAG, "thread pool handle is empty..");
         return CA_STATUS_FAILED;
     }
 
@@ -285,7 +285,7 @@ CAResult_t CARetransmissionStart(CARetransmission_t *context)
 
     if (res != CA_STATUS_OK)
     {
-        OIC_LOG_V(ERROR, TAG, "thread pool add task error(send thread).");
+        OIC_LOG(ERROR, TAG, "thread pool add task error(send thread).");
         return res;
     }
 
@@ -297,7 +297,7 @@ CAResult_t CARetransmissionSentData(CARetransmission_t *context,
 {
     if (context == NULL || endpoint == NULL || pdu == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "invalid parameter..");
+        OIC_LOG(ERROR, TAG, "invalid parameter..");
         return CA_STATUS_INVALID_PARAM;
     }
 
@@ -326,7 +326,7 @@ CAResult_t CARetransmissionSentData(CARetransmission_t *context,
 
     if (retData == NULL)
     {
-        OIC_LOG_V(ERROR, TAG, "memory error!!");
+        OIC_LOG(ERROR, TAG, "memory error!!");
         return CA_MEMORY_ALLOC_FAILED;
     }
 
@@ -335,7 +335,7 @@ CAResult_t CARetransmissionSentData(CARetransmission_t *context,
     if (pduData == NULL)
     {
         OICFree(retData);
-        OIC_LOG_V(ERROR, TAG, "memory error!!");
+        OIC_LOG(ERROR, TAG, "memory error!!");
         return CA_MEMORY_ALLOC_FAILED;
     }
     memcpy(pduData, pdu, sizeof(int8_t) * size);
@@ -346,7 +346,7 @@ CAResult_t CARetransmissionSentData(CARetransmission_t *context,
     {
         OICFree(retData);
         OICFree(pduData);
-        OIC_LOG_V(ERROR, TAG, "memory error!!");
+        OIC_LOG(ERROR, TAG, "memory error!!");
         return CA_MEMORY_ALLOC_FAILED;
     }
 
@@ -379,7 +379,7 @@ CAResult_t CARetransmissionSentData(CARetransmission_t *context,
         if (retData != NULL && (currData->endpoint->connectivityType == endpoint->connectivityType)
             && currData->messageId == messageId)
         {
-            OIC_LOG_V(ERROR, TAG, "Duplicate message ID");
+            OIC_LOG(ERROR, TAG, "Duplicate message ID");
 
             // mutex unlock
             u_mutex_unlock(context->threadMutex);
@@ -408,7 +408,7 @@ CAResult_t CARetransmissionReceivedData(CARetransmission_t *context,
 {
     if (context == NULL || endpoint == NULL || pdu == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "invalid parameter..");
+        OIC_LOG(ERROR, TAG, "invalid parameter..");
         return CA_STATUS_INVALID_PARAM;
     }
 
@@ -474,11 +474,11 @@ CAResult_t CARetransmissionStop(CARetransmission_t *context)
 {
     if (context == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "context is empty..");
+        OIC_LOG(ERROR, TAG, "context is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "retransmission stop request!!");
+    OIC_LOG(DEBUG, TAG, "retransmission stop request!!");
 
     // mutex lock
     u_mutex_lock(context->threadMutex);
@@ -501,11 +501,11 @@ CAResult_t CARetransmissionDestroy(CARetransmission_t *context)
 {
     if (context == NULL)
     {
-        OIC_LOG_V(DEBUG, TAG, "context is empty..");
+        OIC_LOG(ERROR, TAG, "context is empty..");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TAG, "retransmission context destroy..");
+    OIC_LOG(DEBUG, TAG, "retransmission context destroy..");
 
     u_mutex_free(context->threadMutex);
     context->threadMutex = NULL;