X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Fsrc%2Fcamessagehandler.c;h=ebd322b480ec9e63ea3fb06360f7d6cfe45aed5d;hb=53427ddcd8a79536638ce85e61a6630a9e6b3139;hp=badb5f86c1c99f7736986bd4ab3c2e49d4a91921;hpb=825d77740ba8e697deda3268eecfb1192d16c0e6;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/src/camessagehandler.c b/resource/csdk/connectivity/src/camessagehandler.c index badb5f8..ebd322b 100755 --- a/resource/csdk/connectivity/src/camessagehandler.c +++ b/resource/csdk/connectivity/src/camessagehandler.c @@ -51,6 +51,8 @@ #define SINGLE_HANDLE #define MAX_THREAD_POOL_SIZE 20 +#define UNUSED(x) (void)(x) + // thread pool handle static ca_thread_pool_t g_threadPoolHandle = NULL; @@ -62,8 +64,6 @@ static CAQueueingThread_t g_receiveThread; #define CA_MAX_RT_ARRAY_SIZE 3 #endif // SINGLE_THREAD -#define RECEIVE_QUEUE_MAX_SIZE 100 - #define TAG "OIC_CA_MSG_HANDLE" static CARetransmission_t g_retransmissionContext; @@ -758,43 +758,6 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui return ret; } -// NOTE: This is test method for CONPRO-1172 -static SendDirectErrorResponsetoPeer(CAData_t* cadata) -{ - CARequestInfo_t *reqInfo = cadata->requestInfo; - - CAResponseInfo_t respInfo = { .result = CA_INTERNAL_SERVER_ERROR }; - respInfo.info.messageId = reqInfo->info.messageId; - respInfo.info.numOptions = reqInfo->info.numOptions; - - if (respInfo.info.numOptions) - { - respInfo.info.options = - (CAHeaderOption_t *)OICCalloc(respInfo.info.numOptions, sizeof(CAHeaderOption_t)); - memcpy (respInfo.info.options, reqInfo->info.options, - sizeof(CAHeaderOption_t) * respInfo.info.numOptions); - - } - - respInfo.info.payload = NULL; - respInfo.info.token = reqInfo->info.token; - respInfo.info.tokenLength = reqInfo->info.tokenLength; - respInfo.info.type = reqInfo->info.type; - respInfo.info.resourceUri = OICStrdup (reqInfo->info.resourceUri); - respInfo.info.acceptFormat = CA_FORMAT_UNDEFINED; - respInfo.info.dataType = CA_RESPONSE_DATA; - - CAResult_t caResult = CASendResponse(cadata->remoteEndpoint, &respInfo); - // resourceUri in the info field is cloned in the CA layer and - // thus ownership is still here. - OICFree (respInfo.info.resourceUri); - OICFree (respInfo.info.options); - if(CA_STATUS_OK != caResult) - { - OIC_LOG_V(ERROR, TAG, "CASendResponse error - %d", caResult); - } -} - static CAResult_t CAReceivedPacketCallback(const CASecureEndpoint_t *sep, const void *data, uint32_t dataLen) { @@ -912,18 +875,7 @@ static CAResult_t CAReceivedPacketCallback(const CASecureEndpoint_t *sep, else #endif { - // NOTE: This is test logic for CONPRO-1172 - size_t queueSize = CAQueueingThreadGetQueueSize(&g_receiveThread); - if (queueSize <= RECEIVE_QUEUE_MAX_SIZE) - { - CAQueueingThreadAddData(&g_receiveThread, cadata, sizeof(CAData_t)); - } - else - { - OIC_LOG_V(INFO, TAG, "Receive queue size(%"PRIuPTR") is > its threshold limit(%d)", queueSize, RECEIVE_QUEUE_MAX_SIZE); - SendDirectErrorResponsetoPeer(cadata); - CADestroyData(cadata, sizeof(CAData_t)); - } + CAQueueingThreadAddData(&g_receiveThread, cadata, sizeof(CAData_t)); } #endif // SINGLE_THREAD @@ -945,8 +897,7 @@ static void CAAdapterStateChangedCallback(CATransportAdapter_t transportType, bo static bool CAClearQueueEndpointDataContext(void *data, uint32_t size, void *ctx) { - (void)size; - + UNUSED(size); if (NULL == data || NULL == ctx) { return false; @@ -1224,8 +1175,8 @@ void CASetNetworkMonitorCallback(CANetworkMonitorCallback nwMonitorHandler) CAResult_t CAInitializeMessageHandler(CATransportAdapter_t transportType) { - CASetPacketReceivedCallback(CAReceivedPacketCallback); - CASetErrorHandleCallback(CAErrorHandler); + CASetPacketReceivedCallback((CANetworkPacketReceivedCallback)CAReceivedPacketCallback); + CASetErrorHandleCallback((CAErrorHandleCallback)CAErrorHandler); #ifndef SINGLE_THREAD // create thread pool @@ -1658,7 +1609,7 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) if (NULL != data->remoteEndpoint) { CALogAdapterTypeInfo(data->remoteEndpoint->adapter); - OIC_LOG_V(INFO, ANALYZER_TAG, "Address = [%s]:[%d]", data->remoteEndpoint->addr, + OIC_LOG_V(DEBUG, ANALYZER_TAG, "Address = [%s]:[%d]", data->remoteEndpoint->addr, data->remoteEndpoint->port); }