From: jihwan.seo Date: Wed, 16 Nov 2016 05:11:16 +0000 (+0900) Subject: fix findresource failure issue. X-Git-Tag: 1.3.0~1053^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf559e9f08810c75dd910aec17baa04639826ba3;p=platform%2Fupstream%2Fiotivity.git fix findresource failure issue. this fix is from https://gerrit.iotivity.org/gerrit/#/c/12283/ Change-Id: I70314bdc6506101b551c9389bb694cad3bf222f5 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/14397 Reviewed-by: Dave Thaler Tested-by: jenkins-iotivity Reviewed-by: Habib Virji --- diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index 4ca5f95..5154450 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -657,7 +657,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. @@ -673,7 +673,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)) @@ -681,14 +680,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 @@ -826,25 +821,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; } } }