From: Saurav Babu Date: Fri, 23 Mar 2018 11:18:47 +0000 (+0530) Subject: comp-manager: Fixed issue in sending response of Post Request X-Git-Tag: submit/tizen/20190131.065036~86 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=136e9dc65981c3646482bc3fd28a02a9b0225bf3;p=platform%2Fcore%2Fapi%2Fmulti-device-group.git comp-manager: Fixed issue in sending response of Post Request Signed-off-by: Saurav Babu --- diff --git a/src/companion-manager/src/comp_iot.cpp b/src/companion-manager/src/comp_iot.cpp index 6443abc..1e8553b 100644 --- a/src/companion-manager/src/comp_iot.cpp +++ b/src/companion-manager/src/comp_iot.cpp @@ -418,6 +418,8 @@ OCEntityHandlerResult _request_handler(std::shared_ptr reques g_free(arg); + pResponse->setRequestHandle(request->getRequestHandle()); + pResponse->setResourceHandle(request->getResourceHandle()); pResponse->setErrorCode(200); pResponse->setResponseResult(OC_EH_OK); OCPlatform::sendResponse(pResponse); @@ -498,7 +500,8 @@ static void _clear_user_data(void *user_data) } static void _on_post(const HeaderOptions& /*headerOptions*/, - const OCRepresentation& rep, const int eCode) + const OCRepresentation& rep, const int eCode, + void *user_data) { last_get_result = eCode; int ret; @@ -513,6 +516,7 @@ static void _on_post(const HeaderOptions& /*headerOptions*/, LOG_ERR("Exception %s in on post", e.what()); } + _clear_user_data(user_data); } static bool _found_resource(std::shared_ptr resource, @@ -614,7 +618,9 @@ static bool _found_resource(std::shared_ptr resource, rep.setValue("data", std::string(cmd->arg1)); #endif } - resource->post(rep, QueryParamsMap(), &_on_post); + resource->post(rep, QueryParamsMap(), + std::bind (&_on_post, std::placeholders::_1, + std::placeholders::_2, std::placeholders::_3, cmd)); } }