summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Cotter <matt.cotter@mongodb.com>2016-03-28 14:11:05 -0400
committerMatt Cotter <matt.cotter@mongodb.com>2016-03-28 16:37:06 -0400
commit44fbaf79a3d76ce3476618759385a585b8f3fa45 (patch)
tree610fd709789f0fe054abea9af1e0622ef1930d9f
parent26603490725d969247044de4f36f487972264023 (diff)
downloadmongo-44fbaf79a3d76ce3476618759385a585b8f3fa45.tar.gz
SERVER-23199 switch setAlarm to use system clock
-rw-r--r--src/mongo/executor/network_interface_asio.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/executor/network_interface_asio.cpp b/src/mongo/executor/network_interface_asio.cpp
index 8138bf43798..cf5d82c98b3 100644
--- a/src/mongo/executor/network_interface_asio.cpp
+++ b/src/mongo/executor/network_interface_asio.cpp
@@ -32,6 +32,8 @@
#include "mongo/executor/network_interface_asio.h"
+#include <asio/system_timer.hpp>
+
#include <utility>
#include "mongo/executor/async_stream_factory.h"
@@ -406,12 +408,9 @@ void NetworkInterfaceASIO::cancelAllCommands() {
}
}
-const auto kMaxTimerDuration = duration_cast<Milliseconds>(asio::steady_timer::duration::max());
-
void NetworkInterfaceASIO::setAlarm(Date_t when, const stdx::function<void()>& action) {
// "alarm" must stay alive until it expires, hence the shared_ptr.
- auto alarm = std::make_shared<asio::steady_timer>(_io_service,
- std::min(when - now(), kMaxTimerDuration));
+ auto alarm = std::make_shared<asio::system_timer>(_io_service, when.toSystemTimePoint());
alarm->async_wait([alarm, this, action](std::error_code ec) {
if (!ec) {
return action();