From d2f91e300c3417e409a1bcdf8fd8c5ff347b1f09 Mon Sep 17 00:00:00 2001 From: Jihun Ha Date: Sat, 6 Aug 2016 10:32:46 +0900 Subject: [PATCH] Fix a logic in linking child representation payload in batch interface If provisioning resource receives a GET request with BATCH interface and cloud resource is not created by user's decision, device configuration resource's representation will not delivered even if device configuration resource exists. This patch fixes this issue. Change-Id: I90a43e58cf12dab0732857418fae7f4a7ef9dc1a Signed-off-by: Jihun Ha Reviewed-on: https://gerrit.iotivity.org/gerrit/10091 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- service/easy-setup/enrollee/src/resourcehandler.c | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index ed90ddf..b655e27 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -552,25 +552,31 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) { if(strstr(ehRequest->query, OC_RSRVD_INTERFACE_BATCH)) {// When Provisioning resource has a GET with BatchInterface - payload->next = constructResponseOfWiFi(); + OCRepPayload* head = payload; + OCRepPayload* nextPayload = NULL; - if(payload->next) + nextPayload = constructResponseOfWiFi(); + if(nextPayload != NULL) { - payload->next->next = constructResponseOfCloud(); - } - else - { - return payload; + payload->next = nextPayload; + payload = payload->next; } - if(payload->next->next) + nextPayload = constructResponseOfCloud(); + if(nextPayload != NULL) { - payload->next->next->next = constructResponseOfDevConf(); + payload->next = nextPayload; + payload = payload->next; } - else + + nextPayload = constructResponseOfDevConf(); + if(nextPayload != NULL) { - return payload; + payload->next = nextPayload; + payload = payload->next; } + + payload = head; } } @@ -978,4 +984,4 @@ const char *getResult(OCStackResult result) default: return "UNKNOWN"; } -} \ No newline at end of file +} -- 2.7.4