[IOT-2913] Mirror d.di to match doxm.deviceuuid 07/23507/2
authorMushfiqul Islam Antu <i.mushfiq@samsung.com>
Wed, 29 Nov 2017 06:08:07 +0000 (12:08 +0600)
committerMushfiqul Islam <i.mushfiq@samsung.com>
Wed, 29 Nov 2017 11:13:36 +0000 (11:13 +0000)
OCGetServerInstanceID() & OCGetServerInstanceID() these 2
APIs were keeping a local copy of doxm.deviceuuid, while
there is no way to keep track whether doxm.deviceuuid was
updated by the provisioning manager. So local copies are
removed, each time d.di is required, it will be fetched
doxm.deviceuuid

Change-Id: I017bed18d3e0ad568b662a03d9bd80134538a8c2
Signed-off-by: Mushfiqul Islam Antu <i.mushfiq@samsung.com>
resource/csdk/stack/src/ocstack.c

index f3505b3..ac2e664 100644 (file)
@@ -5735,32 +5735,21 @@ OCStackResult getQueryFromUri(const char * uri, char** query, char ** uriWithout
 
 static const OicUuid_t* OC_CALL OCGetServerInstanceID(void)
 {
-    static bool generated = false;
     static OicUuid_t sid;
-    if (generated)
-    {
-        return &sid;
-    }
 
     if (OC_STACK_OK != GetDoxmDeviceID(&sid))
     {
         OIC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!");
         return NULL;
     }
-    generated = true;
+
     return &sid;
 }
 
 const char* OC_CALL OCGetServerInstanceIDString(void)
 {
-    static bool generated = false;
     static char sidStr[UUID_STRING_SIZE];
 
-    if (generated)
-    {
-        return sidStr;
-    }
-
     const OicUuid_t *sid = OCGetServerInstanceID();
     if(sid && !OCConvertUuidToString(sid->id, sidStr))
     {
@@ -5768,7 +5757,6 @@ const char* OC_CALL OCGetServerInstanceIDString(void)
         return NULL;
     }
 
-    generated = true;
     return sidStr;
 }