summaryrefslogtreecommitdiff
path: root/resource/csdk/stack
diff options
context:
space:
mode:
authorSushil Yadav <sushil.ky@samsung.com>2017-05-09 15:39:04 +0530
committerAshok Babu Channa <ashok.channa@samsung.com>2017-05-11 08:34:38 +0000
commit5dbfa668a0694b8083fc7b425ec91dc3bd64f9d3 (patch)
treeeb7426da3b8608a4643a0d68c48371fa474aa9eb /resource/csdk/stack
parent5742af4746304cca8dc35bdd2c35d910462b6ca6 (diff)
downloadiotivity-5dbfa668a0694b8083fc7b425ec91dc3bd64f9d3.tar.gz
iotivity-5dbfa668a0694b8083fc7b425ec91dc3bd64f9d3.tar.bz2
iotivity-5dbfa668a0694b8083fc7b425ec91dc3bd64f9d3.zip
[IOT-1893] Delete Request Logic Fixed.
Change-Id: I0df40af7c198e3e26aa5450da3489e5876628acc Signed-off-by: Sushil Yadav <sushil.ky@samsung.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/19743 Tested-by: jenkins-iotivity <jenkins@iotivity.org> Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com> Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Diffstat (limited to 'resource/csdk/stack')
-rwxr-xr-xresource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp17
-rw-r--r--resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp6
2 files changed, 13 insertions, 10 deletions
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
index ee934d950..3489ef743 100755
--- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
+++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
@@ -777,7 +777,11 @@ void* RequestDeleteDeathResourceTask(void* myqos)
if (OC_STACK_OK != result)
{
- OIC_LOG(INFO, TAG, "Second DELETE call did not succeed");
+ OIC_LOG(INFO, TAG, "Second DELETE Request also failed");
+ }
+ else
+ {
+ OIC_LOG(INFO, TAG, "Second DELETE Request sent successfully; Waiting for Callback");
}
return NULL;
@@ -798,16 +802,15 @@ int InitDeleteRequest(OCQualityOfService qos)
if (OC_STACK_OK != result)
{
// Error can happen if for example, network connectivity is down
- OIC_LOG(INFO, TAG, "First DELETE call did not succeed");
- }
- else
- {
+ OIC_LOG(INFO, TAG, "DELETE Request did not succeed; Will try again.");
//Create a thread to delete this resource again
pthread_t threadId;
pthread_create (&threadId, NULL, RequestDeleteDeathResourceTask, (void*)qos);
}
-
- OIC_LOG_V(INFO, TAG, "\n\nExit %s", __func__);
+ else
+ {
+ OIC_LOG(INFO, TAG, "DELETE Request sent successfully; Waiting for Callback");
+ }
return result;
}
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
index 0c110481f..78bf24bca 100644
--- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
+++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
@@ -369,7 +369,7 @@ OCEntityHandlerResult ProcessDeleteRequest (OCEntityHandlerRequest *ehRequest)
if (result == OC_STACK_OK)
{
OIC_LOG (INFO, TAG, "\n\nDelete Resource operation succeeded.");
- ehResult = OC_EH_OK;
+ ehResult = OC_EH_RESOURCE_DELETED;
//Step 2: clear observers who wanted to observe this resource at the app level.
for (uint8_t i = 0; i < SAMPLE_MAX_NUM_OBSERVATIONS; i++)
@@ -385,7 +385,7 @@ OCEntityHandlerResult ProcessDeleteRequest (OCEntityHandlerRequest *ehRequest)
else if (result == OC_STACK_NO_RESOURCE)
{
OIC_LOG(INFO, TAG, "\n\nThe resource doesn't exist or it might have been deleted.");
- ehResult = OC_EH_RESOURCE_DELETED;
+ ehResult = OC_EH_RESOURCE_NOT_FOUND;
}
else
{
@@ -1129,7 +1129,7 @@ int main(int argc, char* argv[])
OCSetRAInfo(&rainfo);
#endif
-
+
OIC_LOG(DEBUG, TAG, "OCServer is starting...");
OCPersistentStorage pstStr {
server_fopen,