https://jira.iotivity.org/browse/IOT-2355
The IPCA unit test "IsIoTivityWorking" has failed sporadically.
This test directly uses IoTivity OC APIs to ensure that the underlying
IoTivity stack is working.
The 2 second timeout is incorrect, it should follow RFC 7252.
Change-Id: Iff640c2dbc2423e4865a4d2c8856a766d5345fa4
Signed-off-by: Soemin Tjong <stjong@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20375
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
// elevator server.
loopCount = 0;
const int TARGET_FLOOR = 3;
- elevatorClient.SetTargetFloor(TARGET_FLOOR);
- while ((loopCount++ < 20) && (g_testElevator1.GetCurrentFloor() != TARGET_FLOOR))
- {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
+ elevatorClient.SetTargetFloor(TARGET_FLOOR); // SetTargetFloor() is synchronous.
EXPECT_EQ(TARGET_FLOOR, g_testElevator1.GetCurrentFloor());
// Confirm able to get current floor using IoTivity client API. The current floor should be
return result == OC_STACK_OK ? true : false;\r
}\r
\r
-const int DEFAULT_WAITTIME = 2000;\r
-bool ElevatorClient::WaitForCallback(int waitingTime = DEFAULT_WAITTIME)\r
+// Outstanding requests should time out in 247 seconds (EXCHANGE_LIFETIME) per rfc 7252.\r
+const int DEFAULT_WAITTIME_MS = 247000;\r
+bool ElevatorClient::WaitForCallback(int waitTimeMs = DEFAULT_WAITTIME_MS)\r
{\r
std::unique_lock<std::mutex> lock { syncMutex };\r
\r
- if (syncCV.wait_for(lock, std::chrono::milliseconds{ waitingTime }) != std::cv_status::timeout)\r
+ if (syncCV.wait_for(lock, std::chrono::milliseconds{ waitTimeMs }) != std::cv_status::timeout)\r
{\r
return true;\r
}\r