- 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>
#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
if (data == NULL)
{
- OIC_LOG(DEBUG, TAG, "thread data error!!");
+ OIC_LOG(ERROR, TAG, "thread data error!!");
return;
}
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,
}
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,
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
}
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)
{
const CARequestInfo_t *request)
{
// ToDo
- OIC_LOG_V(DEBUG, TAG, "CADetachRequestToAllMessage");
+ OIC_LOG(DEBUG, TAG, "CADetachRequestToAllMessage");
if (object == NULL || request == NULL)
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)
{
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;
if (res != CA_STATUS_OK)
{
- OIC_LOG_V(ERROR, TAG, "thread pool initialize error.");
+ OIC_LOG(ERROR, TAG, "thread pool initialize error.");
return res;
}
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;
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
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;
}
// 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!");
}
#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
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;
}
// 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
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,
{
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;
{
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;
}
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;
{
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;
}
if (message == NULL)
{
- OIC_LOG_V(ERROR, TAG, "memory error!!");
+ OIC_LOG(ERROR, TAG, "memory error!!");
return CA_MEMORY_ALLOC_FAILED;
}
{
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;
{
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)
{
}
else
{
- OIC_LOG_V(ERROR, TAG, "arraylist remove error");
+ OIC_LOG(ERROR, TAG, "arraylist remove error");
}
}
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;
}
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
{
u_cond_signal(context->threadCond);
- OIC_LOG_V(DEBUG, TAG, "retransmission main thread end..");
+ OIC_LOG(DEBUG, TAG, "retransmission main thread end..");
}
{
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));
{
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;
}
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;
}
{
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;
}
if (retData == NULL)
{
- OIC_LOG_V(ERROR, TAG, "memory error!!");
+ OIC_LOG(ERROR, TAG, "memory error!!");
return CA_MEMORY_ALLOC_FAILED;
}
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);
{
OICFree(retData);
OICFree(pduData);
- OIC_LOG_V(ERROR, TAG, "memory error!!");
+ OIC_LOG(ERROR, TAG, "memory error!!");
return CA_MEMORY_ALLOC_FAILED;
}
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);
{
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;
}
{
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);
{
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;