diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2020-11-11 04:30:36 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-17 01:16:21 +0000 |
commit | 8606f356c4af4bb2fc279195132d3a8530d14305 (patch) | |
tree | cb2a0740565a989e63c73c9f78eee734128f974a /src/mongo | |
parent | ab0703b3c6ad1607fa224c5be2b893ddbdad365e (diff) | |
download | mongo-8606f356c4af4bb2fc279195132d3a8530d14305.tar.gz |
SERVER-52819 Reorder TransportLayer construction in mongobridge
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/tools/bridge.cpp | 23 |
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; } |