}
else
{
- // if the received response message type is CON, send empty message.
- // and then, send next block request message with new messagId.
- if (msgType == CA_MSG_CONFIRM)
- {
- CASendDirectEmptyResponse(data->remoteEndpoint,
- data->requestInfo->info.messageId);
- sentMsgType = CA_MSG_CONFIRM;
- }
-
if (data->requestInfo)
{
+ // if the received response message type is CON, send empty message.
+ // and then, send next block request message with new messagId.
+ if (msgType == CA_MSG_CONFIRM)
+ {
+ CASendDirectEmptyResponse(data->remoteEndpoint,
+ data->requestInfo->info.messageId);
+ sentMsgType = CA_MSG_CONFIRM;
+ }
+
OIC_LOG(DEBUG, TAG, "need new msgID");
data->requestInfo->info.messageId = 0;
data->requestInfo->info.type = sentMsgType;
}
+ else if (data->responseInfo)
+ {
+ data->responseInfo->info.messageId = pdu->transport_hdr->udp.id;
+ data->responseInfo->info.type = sentMsgType;
+ }
}
// add data to send thread
OIC_LOG(ERROR, TAG, "it didn't order");
return CA_BLOCK_INCOMPLETE;
}
- return CA_BLOCK_RECEIVED_ALREADY;
+ else
+ {
+ OIC_LOG(ERROR, TAG, "already received this block");
+ return CA_BLOCK_RECEIVED_ALREADY;
+ }
}
}
VERIFY_NON_NULL_VOID(data, TAG, "data");
CAFreeEndpoint(data->remoteEndpoint);
- CADestroyRequestInfoInternal(data->requestInfo);
- CADestroyResponseInfoInternal(data->responseInfo);
+ if (data->requestInfo)
+ {
+ CADestroyRequestInfoInternal(data->requestInfo);
+ }
+ if (data->responseInfo)
+ {
+ CADestroyResponseInfoInternal(data->responseInfo);
+ }
OICFree(data);
}