replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / stack / src / ocobserve.c
index f7b2d3c..9cc6557 100644 (file)
@@ -370,7 +370,10 @@ OCStackResult GenerateObserverId (OCObservationId *observationId)
 
     do
     {
-        *observationId = OCGetRandomByte();
+        do
+        {
+            *observationId = OCGetRandomByte();
+        } while (0 == *observationId); //Make sure *observationId is not 0
         // Check if observation Id already exists
         resObs = GetObserverUsingId (*observationId);
     } while (NULL != resObs);
@@ -435,11 +438,13 @@ OCStackResult AddObserver (const char         *resUri,
         obsNode->devAddr = *devAddr;
         obsNode->resource = resHandle;
 
+#ifdef WITH_PRESENCE
         if ((strcmp(resUri, OC_RSRVD_PRESENCE_URI) == 0))
         {
             obsNode->TTL = 0;
         }
         else
+#endif
         {
             obsNode->TTL = GetTicks(MAX_OBSERVER_TTL_SECONDS * MILLISECONDS_PER_SECOND);
         }