Commit f1dbb4be authored by Jihun Ha's avatar Jihun Ha Committed by Madan Lanka

Fix a logic to send a response even in case to wrong request

Even if request handling fails for some reasons, a response for the request
should be sent back to Mediator.

Change-Id: I70db07e9fb58f00613e7613de4d7ae06cc9b5bf9
Signed-off-by: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10493Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarHemant Mahsky <h.mahsky@samsung.com>
Reviewed-by: default avatarMadan Lanka <lanka.madan@samsung.com>
parent 920553bf
......@@ -925,27 +925,24 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
}
}
if (ehRet == OC_EH_OK)
// Format the response. Note this requires some info about the request
response.requestHandle = entityHandlerRequest->requestHandle;
response.resourceHandle = entityHandlerRequest->resource;
response.ehResult = ehRet;
//response uses OCPaylod while all get,put methodes use OCRepPayload
response.payload = (OCPayload*) (payload);
response.numSendVendorSpecificHeaderOptions = 0;
memset(response.sendVendorSpecificHeaderOptions, 0,
sizeof(response.sendVendorSpecificHeaderOptions));
memset(response.resourceUri, 0, sizeof(response.resourceUri));
// Indicate that response is NOT in a persistent buffer
response.persistentBufferFlag = 0;
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
// Format the response. Note this requires some info about the request
response.requestHandle = entityHandlerRequest->requestHandle;
response.resourceHandle = entityHandlerRequest->resource;
response.ehResult = ehRet;
//response uses OCPaylod while all get,put methodes use OCRepPayload
response.payload = (OCPayload*) (payload);
response.numSendVendorSpecificHeaderOptions = 0;
memset(response.sendVendorSpecificHeaderOptions, 0,
sizeof(response.sendVendorSpecificHeaderOptions));
memset(response.resourceUri, 0, sizeof(response.resourceUri));
// Indicate that response is NOT in a persistent buffer
response.persistentBufferFlag = 0;
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
OIC_LOG(ERROR, ES_RH_TAG, "Error sending response");
ehRet = OC_EH_ERROR;
}
OIC_LOG(ERROR, ES_RH_TAG, "Error sending response");
ehRet = OC_EH_ERROR;
}
}
......
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