summaryrefslogtreecommitdiffstats
path: root/fnet/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-12-01 10:40:36 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-12-01 14:52:43 +0000
commit5b54a8f0613183596c8a8259c659e4a942b1304d (patch)
tree7fa9f4c7f1a6048242aa4e9d8d4e396f15c262c6 /fnet/src/tests
parent39024d12a8f0c522c4cc5210e4f3f917ef620294 (diff)
- Separate out the tail of the EventLoop into separate method to ease readability.
- Also separate out timeout handling of old connections to separate method and unify on vespalib::time.
Diffstat (limited to 'fnet/src/tests')
-rw-r--r--fnet/src/tests/scheduling/schedule.cpp4
-rw-r--r--fnet/src/tests/scheduling/sloweventloop.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/fnet/src/tests/scheduling/schedule.cpp b/fnet/src/tests/scheduling/schedule.cpp
index fc5b5687c87..bf9f688b271 100644
--- a/fnet/src/tests/scheduling/schedule.cpp
+++ b/fnet/src/tests/scheduling/schedule.cpp
@@ -3,8 +3,8 @@
#include <vespa/fnet/scheduler.h>
#include <vespa/fnet/task.h>
-using my_clock = FNET_Scheduler::clock;
-using time_point = my_clock::time_point;
+using my_clock = vespalib::steady_clock;
+using time_point = vespalib::steady_time;
using ms_double = std::chrono::duration<double, std::milli>;
time_point _time;
diff --git a/fnet/src/tests/scheduling/sloweventloop.cpp b/fnet/src/tests/scheduling/sloweventloop.cpp
index a36afbc9d92..33070aa29e9 100644
--- a/fnet/src/tests/scheduling/sloweventloop.cpp
+++ b/fnet/src/tests/scheduling/sloweventloop.cpp
@@ -18,14 +18,14 @@ public:
TEST("slow event loop") {
- FNET_Scheduler::time_point t(std::chrono::milliseconds(0));
+ vespalib::steady_time t(vespalib::duration::zero());
FNET_Scheduler scheduler(&t, &t);
MyTask task(scheduler);
MyTask task2(scheduler);
scheduler.CheckTasks();
- t += std::chrono::milliseconds(10000);
+ t += 10s;
task.Schedule(5.0);
uint32_t cnt = 0;
@@ -35,7 +35,7 @@ TEST("slow event loop") {
break;
}
++cnt;
- t += std::chrono::milliseconds(1);
+ t += 1ms;
}
if (!EXPECT_TRUE(cnt > 4700 && cnt < 4800)) {
@@ -43,7 +43,7 @@ TEST("slow event loop") {
}
scheduler.CheckTasks();
- t += std::chrono::milliseconds(10000);
+ t += 10s;
task2.Schedule(5.0);
uint32_t cnt2 = 0;
@@ -53,7 +53,7 @@ TEST("slow event loop") {
break;
}
++cnt2;
- t += std::chrono::milliseconds(10000);
+ t += 10s;
}
if (!EXPECT_TRUE(cnt2 > 15 && cnt2 < 25)) {