#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;
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)
{
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
* proper destination and remove "RM" coap header option before passing request / response to
* RI as this option will make no sense to either RI or application.
*/
- if (responseInfo->info.options)
- {
- RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
+ RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
(uint8_t *) &(responseInfo->info.numOptions),
(CAEndpoint_t *) endPoint);
- }
#endif
OCHandleResponse(endPoint, responseInfo);
{
OIC_LOG_V(ERROR, TAG, "HandleStackRequests failed. error: %d", requestResult);
- // Delete observer node if it is OBSERVE failure from app
- if (serverRequest.observationOption == OC_OBSERVE_REGISTER)
- {
- DeleteObserverUsingToken(requestInfo->info.token, requestInfo->info.tokenLength);
- }
-
CAResponseResult_t stackResponse =
OCToCAStackResult(requestResult, serverRequest.method);
* Put source in sender endpoint so that the next packet from application can be routed to
* proper destination and remove RM header option.
*/
- if (requestInfo->info.options)
- {
- RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
+ RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
(uint8_t *) &(requestInfo->info.numOptions),
(CAEndpoint_t *) endPoint);
- }
#ifdef ROUTING_GATEWAY
if (isEmptyMsg)