Commit 7f8b0093 authored by arya.k's avatar arya.k Committed by Ashok Babu Channa

[IOT-1891] [RI] Issue fix OBSERVE Cancellation High QoS

When cancel observe is requested by client, the callback should return
a sequence number greater than MAX_SEQUENCE_NUMBER, and with no observe
header option.
Currently it is returning 0 which is not correct.So stack has been
modified to return a higher sequence number with the callback
for cancel observe confirmed response.

Change-Id: I85ea87454e3ca96f22fe7e414189ec0be7ea8dd8
Signed-off-by: default avatararya.k <arya.kumar@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19651Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
parent d3cd8550
......@@ -1673,6 +1673,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp
}
response->devAddr.adapter = OC_DEFAULT_ADAPTER;
response->sequenceNumber = MAX_SEQUENCE_NUMBER + 1;
CopyEndpointToDevAddr(endPoint, &response->devAddr);
FixUpClientResponse(response);
response->resourceUri = responseInfo->info.resourceUri;
......
......@@ -110,6 +110,8 @@ void onObserve(const HeaderOptions /*headerOptions*/, const OCRepresentation& re
std::cout << "No observe option header is returned in the response." << std::endl;
std::cout << "For a registration request, it means the registration failed"
<< std::endl;
std::cout << "For a cancelation request, it means the cancelation was successful"
<< std::endl;
}
else
{
......
......@@ -37,6 +37,8 @@
#include <windows.h>
#endif
#define MAX_SEQUENCE_NUMBER (0xFFFFFF)
using namespace OC;
struct dereference_compare
......@@ -85,7 +87,7 @@ void onObserve(const HeaderOptions /*headerOptions*/, const OCRepresentation& re
{
std::cout << "\tObserve Registration Confirmed: "<< std::endl;
}
else if (sequenceNumber == (int) ObserveAction::ObserveUnregister)
else if (sequenceNumber == (MAX_SEQUENCE_NUMBER + 1))
{
std::cout << "\tObserve Cancel Confirmed: "<< std::endl;
sleep(10);
......
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