summaryrefslogtreecommitdiff
path: root/src/mongo/tools/bridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/tools/bridge.cpp')
-rw-r--r--src/mongo/tools/bridge.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index 1c2f7d46bc9..d78db632536 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -484,24 +484,29 @@ int bridgeMain(int argc, char** argv) {
setGlobalServiceContext(ServiceContext::make());
auto serviceContext = getGlobalServiceContext();
+
serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointBridge>(serviceContext));
+
+ {
+ transport::TransportLayerASIO::Options opts;
+ opts.ipList.emplace_back("0.0.0.0");
+ opts.port = mongoBridgeGlobalParams.port;
+
+ auto tl = std::make_unique<mongo::transport::TransportLayerASIO>(
+ opts, serviceContext->getServiceEntryPoint());
+ serviceContext->setTransportLayer(std::move(tl));
+ }
+
if (auto status = serviceContext->getServiceEntryPoint()->start(); !status.isOK()) {
LOGV2(4907203, "Error starting service entry point", "error"_attr = status);
}
- transport::TransportLayerASIO::Options opts;
- opts.ipList.emplace_back("0.0.0.0");
- opts.port = mongoBridgeGlobalParams.port;
-
- serviceContext->setTransportLayer(std::make_unique<mongo::transport::TransportLayerASIO>(
- opts, serviceContext->getServiceEntryPoint()));
- auto tl = serviceContext->getTransportLayer();
- if (auto status = tl->setup(); !status.isOK()) {
+ if (auto status = serviceContext->getTransportLayer()->setup(); !status.isOK()) {
LOGV2(22922, "Error setting up transport layer", "error"_attr = status);
return EXIT_NET_ERROR;
}
- if (auto status = tl->start(); !status.isOK()) {
+ if (auto status = serviceContext->getTransportLayer()->start(); !status.isOK()) {
LOGV2(22923, "Error starting transport layer", "error"_attr = status);
return EXIT_NET_ERROR;
}