Changed api's name 'requestTimer' to 'postTimer'
authordoil.kwon <doil.kwon@samsung.com>
Mon, 13 Jul 2015 13:28:17 +0000 (22:28 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 14 Jul 2015 05:27:12 +0000 (05:27 +0000)
Changed api's value's unit 'second' to 'millisecond'

Defined about api's value for using 'expiryTimer'

- MILLISECOND
- SECOND

Change-Id: I92fb805a9cd7351d6971132fb47f83f5f2390ad2
Signed-off-by: doil.kwon <doil.kwon@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1636
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-manipulation/modules/resourceBroker/include/BrokerTypes.h
service/resource-manipulation/modules/resourceBroker/src/ResourcePresence.cpp

index 6ff3cea..08caa99 100755 (executable)
@@ -33,7 +33,8 @@ namespace OIC
     namespace Service
     {
         #define BROKER_TAG PCF("BROKER")
-        #define SAFE_TIME (5l)
+        #define SAFE_MILLISECOND (5000l)
+        #define SAFE_SECOND (5l)
         #define BROKER_TRANSPORT OCConnectivityType::CT_ADAPTER_IP
 
         /*
index 62abd77..54bb9b4 100755 (executable)
@@ -61,7 +61,7 @@ namespace OIC
             = std::unique_ptr<std::list<BrokerRequesterInfoPtr>>
             (new std::list<BrokerRequesterInfoPtr>);
 
-            timeoutHandle = expiryTimer.requestTimer(SAFE_TIME, pTimeoutCB);
+            timeoutHandle = expiryTimer.postTimer(SAFE_MILLISECOND, pTimeoutCB);
 
             primitiveResource->requestGet(pGetCB);
 
@@ -187,8 +187,12 @@ namespace OIC
             currentTime += 0L;
 
             if((receivedTime.load(std::memory_order_relaxed) == 0) ||
-              ((receivedTime + SAFE_TIME) > currentTime ))
+              ((receivedTime + SAFE_SECOND) > currentTime ))
             {
+                this->isWithinTime = false;
+                isTimeoutCB = false;
+                cbCondition.notify_all();
+
                 return NULL;
             }
             this->isWithinTime = false;
@@ -206,8 +210,9 @@ namespace OIC
 
         void * ResourcePresence::pollingCB(unsigned int msg)
         {
+            OC_LOG_V(DEBUG,BROKER_TAG,"IN PollingCB\n");
             this->requestResourceState();
-            timeoutHandle = expiryTimer.requestTimer(SAFE_TIME,pTimeoutCB);
+            timeoutHandle = expiryTimer.postTimer(SAFE_MILLISECOND,pTimeoutCB);
 
             return NULL;
         }
@@ -238,7 +243,7 @@ namespace OIC
             if(mode == BROKER_MODE::NON_PRESENCE_MODE)
             {
                 // TODO set timer & request get
-                expiryTimer.requestTimer(SAFE_TIME,pPollingCB);
+                expiryTimer.postTimer(SAFE_MILLISECOND,pPollingCB);
             }
 
         }