Commit b7b528f1 authored by sonu1.yadav's avatar sonu1.yadav Committed by Erich Keane

put NULL check and corrected the debug log in CASendThreadProcess

Change-Id: I49d3dd4afb71724e6a17cbfb43e777a1efae20e9
Signed-off-by: default avatarsonu1.yadav <sonu1.yadav@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1643Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent 9746d484
......@@ -251,6 +251,7 @@ static void CASendThreadProcess(void *threadData)
if (SEND_TYPE_UNICAST == type)
{
OIC_LOG(DEBUG,TAG,"Unicast message");
if (NULL != data->requestInfo)
{
OIC_LOG(DEBUG, TAG, "requestInfo is available..");
......@@ -266,6 +267,7 @@ static void CASendThreadProcess(void *threadData)
else
{
OIC_LOG(DEBUG, TAG, "request info, response info is empty");
return;
}
// interface controller function call.
......@@ -292,30 +294,46 @@ static void CASendThreadProcess(void *threadData)
coap_delete_pdu(pdu);
}
else
{
OIC_LOG_V(ERROR,TAG,"Failed to generate unicast PDU");
return;
}
}
else if (SEND_TYPE_MULTICAST == type)
{
OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
OIC_LOG(DEBUG,TAG,"Multicast message");
if (NULL != data->requestInfo)
{
OIC_LOG(DEBUG, TAG, "requestInfo is available..");
CAInfo_t *info = &data->requestInfo->info;
CAInfo_t *info = &data->requestInfo->info;
info->options = data->options;
info->numOptions = data->numOptions;
info->options = data->options;
info->numOptions = data->numOptions;
pdu = CAGeneratePDU(CA_GET, info);
if (NULL != pdu)
{
CALogPDUInfo(pdu);
pdu = CAGeneratePDU(CA_GET, info);
if (NULL != pdu)
{
CALogPDUInfo(pdu);
res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
if (CA_STATUS_OK != res)
{
OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
coap_delete_pdu(pdu);
return;
}
res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
if (CA_STATUS_OK != res)
{
OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
coap_delete_pdu(pdu);
return;
}
coap_delete_pdu(pdu);
else
{
OIC_LOG_V(ERROR,TAG,"Failed to generate multicast PDU");
}
}
else
{
OIC_LOG_V(ERROR, TAG, "request info is empty");
}
}
......
......@@ -105,6 +105,7 @@ static void CAProcessData(const CAData_t *data)
if (SEND_TYPE_UNICAST == type)
{
OIC_LOG(DEBUG,TAG,"Unicast Message");
coap_pdu_t *pdu = NULL;
if (NULL != data->requestInfo)
......@@ -122,6 +123,7 @@ static void CAProcessData(const CAData_t *data)
else
{
OIC_LOG(DEBUG, TAG, "request info, response info is empty");
return;
}
// interface controller function call.
......@@ -148,29 +150,46 @@ static void CAProcessData(const CAData_t *data)
coap_delete_pdu(pdu);
}
else
{
OIC_LOG_V(ERROR,TAG,"Failed to Generate Unicast PDU");
return;
}
}
else if (SEND_TYPE_MULTICAST == type)
{
OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
OIC_LOG(DEBUG,TAG,"Multicast Message");
if (NULL != data->requestInfo)
{
OIC_LOG(DEBUG, TAG, "reqInfo avlbl");
CAInfo_t *info = &data->requestInfo->info;
CAInfo_t *info = &data->requestInfo->info;
info->options = data->options;
info->numOptions = data->numOptions;
info->options = data->options;
info->numOptions = data->numOptions;
coap_pdu_t *pdu = (coap_pdu_t *)CAGeneratePDU(CA_GET, info);
coap_pdu_t *pdu = (coap_pdu_t *)CAGeneratePDU(CA_GET, info);
if (NULL != pdu)
{
CALogPDUInfo(pdu);
res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
if(CA_STATUS_OK != res)
if (NULL != pdu)
{
OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
CALogPDUInfo(pdu);
res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
if(CA_STATUS_OK != res)
{
OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
coap_delete_pdu(pdu);
return;
}
coap_delete_pdu(pdu);
return;
}
coap_delete_pdu(pdu);
else
{
OIC_LOG(ERROR,TAG,"Failed to Generate Multicast PDU");
}
}
else
{
OIC_LOG(ERROR,TAG,"requestInfo is empty");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment