From: hyuna0213.jo Date: Tue, 23 Aug 2016 01:15:53 +0000 (+0900) Subject: Send ack response when the request is CON for presence X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75b3a8383a93022f3710c500340f16ff87c8503d;p=contrib%2Fiotivity.git Send ack response when the request is CON for presence If resource-client subscribe presence with CON, resource-server should send the response message to stop the retransmission. Change-Id: I90008dffc6a8940c9f1645c27d4ded6efa6d9421 Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/10755 Tested-by: jenkins-iotivity Reviewed-by: Jaehong Jo Reviewed-by: jihwan seo Reviewed-by: Ashok Babu Channa --- diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index a559413..42b1e24 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -827,6 +827,15 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource if ((virtualUriInRequest == OC_PRESENCE) && (resource->resourceProperties & OC_ACTIVE)) { + // Need to send ACK when the request is CON. + if (request->qos == OC_HIGH_QOS) + { + CAEndpoint_t endpoint = { .adapter = CA_DEFAULT_ADAPTER }; + CopyDevAddrToEndpoint(&request->devAddr, &endpoint); + SendDirectStackResponse(&endpoint, request->coapID, CA_EMPTY, CA_MSG_ACKNOWLEDGE, + 0, NULL, NULL, 0, NULL, CA_RESPONSE_FOR_RES); + } + // Presence uses observer notification api to respond via SendPresenceNotification. SendPresenceNotification(resource->rsrcType, OC_PRESENCE_TRIGGER_CHANGE); }