summaryrefslogtreecommitdiff
path: root/src/mongo/executor/network_interface_factory.cpp
diff options
context:
space:
mode:
authorSamantha Ritter <samantha.ritter@10gen.com>2015-09-13 23:33:58 -0400
committersamantharitter <samantha.ritter@10gen.com>2015-09-17 11:06:55 -0400
commit32cdd0dc1d50dfc31d8007c7787be7486af7565e (patch)
treee51de5a3356768062d5b79ffbad0611cedbb0226 /src/mongo/executor/network_interface_factory.cpp
parentdd4615e26dabd7ac6c2998061da004065cd3cf1a (diff)
downloadmongo-32cdd0dc1d50dfc31d8007c7787be7486af7565e.tar.gz
SERVER-19438 Add the ability to mock timers underneath NetworkInterfaceASIO
Diffstat (limited to 'src/mongo/executor/network_interface_factory.cpp')
-rw-r--r--src/mongo/executor/network_interface_factory.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/executor/network_interface_factory.cpp b/src/mongo/executor/network_interface_factory.cpp
index 67ca8baa6ba..12d17ab43bd 100644
--- a/src/mongo/executor/network_interface_factory.cpp
+++ b/src/mongo/executor/network_interface_factory.cpp
@@ -35,6 +35,7 @@
#include "mongo/executor/async_secure_stream_factory.h"
#include "mongo/executor/async_stream_factory.h"
#include "mongo/executor/async_stream_interface.h"
+#include "mongo/executor/async_timer_asio.h"
#include "mongo/executor/network_connection_hook.h"
#include "mongo/executor/network_interface_asio.h"
#include "mongo/executor/network_interface_impl.h"
@@ -67,14 +68,22 @@ std::unique_ptr<NetworkInterface> makeNetworkInterface() {
std::unique_ptr<NetworkInterface> makeNetworkInterface(
std::unique_ptr<NetworkConnectionHook> hook) {
if (outboundNetworkImpl == kNetworkImplASIO) {
+ NetworkInterfaceASIO::Options options;
+
+ // Set up a timer factory
+ auto timerFactory = stdx::make_unique<AsyncTimerFactoryASIO>();
+ options.timerFactory = std::move(timerFactory);
+
#ifdef MONGO_CONFIG_SSL
if (SSLManagerInterface* manager = getSSLManager()) {
auto factory = stdx::make_unique<AsyncSecureStreamFactory>(manager);
- return stdx::make_unique<NetworkInterfaceASIO>(std::move(factory), std::move(hook));
+ return stdx::make_unique<NetworkInterfaceASIO>(
+ std::move(factory), std::move(hook), std::move(options));
}
#endif
auto factory = stdx::make_unique<AsyncStreamFactory>();
- return stdx::make_unique<NetworkInterfaceASIO>(std::move(factory), std::move(hook));
+ return stdx::make_unique<NetworkInterfaceASIO>(
+ std::move(factory), std::move(hook), std::move(options));
} else {
return stdx::make_unique<NetworkInterfaceImpl>(std::move(hook));