From: jihwan.seo Date: Wed, 16 Nov 2016 05:11:16 +0000 (+0900) Subject: fix findresource failure issue. X-Git-Tag: 1.2.1~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7957efa79d3243c77cab259e1be88474667cbdc8;p=platform%2Fupstream%2Fiotivity.git fix findresource failure issue. this fix is from https://gerrit.iotivity.org/gerrit/#/c/12283/ Change-Id: I322ec7f7a833134f5849eb2157f0025273ebed06 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/14411 Tested-by: jenkins-iotivity Reviewed-by: Habib Virji Reviewed-by: Larry Sachs Reviewed-by: Phil Coval Reviewed-by: Rick Bell Reviewed-by: Uze Choi Reviewed-by: Ashok Babu Channa --- diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index d50d266f0..773cafdcb 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -661,7 +661,7 @@ OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCRes return OCDoResponse(&response); } - +#ifdef RD_SERVER /** * Find resource at the resource directory server. This resource is not local resource but a * remote resource. @@ -677,7 +677,6 @@ OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCRes static OCStackResult findResourceAtRD(const OCResource* resource, const char *interfaceQuery, const char *resourceTypeQuery, OCDiscoveryPayload *discPayload) { -#ifdef RD_SERVER if (strcmp(resource->uri, OC_RSRVD_RD_URI) == 0) { if (OC_STACK_OK == OCRDDatabaseCheckResources(interfaceQuery, resourceTypeQuery, discPayload)) @@ -685,14 +684,10 @@ static OCStackResult findResourceAtRD(const OCResource* resource, const char *in return OC_STACK_OK; } } -#else - OC_UNUSED(resource); - OC_UNUSED(interfaceQuery); - OC_UNUSED(resourceTypeQuery); - OC_UNUSED(discPayload); -#endif + return OC_STACK_NO_RESOURCE; } +#endif /** * Creates a discovery payload and add device id information. This information is included in all @@ -830,25 +825,23 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource #endif for (; resource && discoveryResult == OC_STACK_OK; resource = resource->next) { + discoveryResult = OC_STACK_NO_RESOURCE; +#ifdef RD_SERVER discoveryResult = findResourceAtRD(resource, interfaceQuery, resourceTypeQuery, discPayload); +#endif if (OC_STACK_NO_RESOURCE == discoveryResult) { if ((!baselineQuery && (resource->resourceProperties & prop)) || (baselineQuery && (includeThisResourceInResponse(resource, interfaceQuery, resourceTypeQuery)))) { - if ((!baselineQuery && (resource->resourceProperties & prop)) || - (baselineQuery && (includeThisResourceInResponse(resource, interfaceQuery, - resourceTypeQuery)))) - { - discoveryResult = BuildVirtualResourceResponse(resource, discPayload, - &request->devAddr); - } - else - { - discoveryResult = OC_STACK_OK; - } + discoveryResult = BuildVirtualResourceResponse(resource, discPayload, + &request->devAddr); + } + else + { + discoveryResult = OC_STACK_OK; } } }