diff options
Diffstat (limited to 'src/mongo')
20 files changed, 212 insertions, 212 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index c4c832cbcd5..04f35baef1c 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -46,7 +46,7 @@ #include "mongo/dbtests/dbtests.h" #include "mongo/idl/server_parameter_test_util.h" #include "mongo/logv2/log.h" -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault @@ -100,9 +100,9 @@ public: _defaultReplSettings( ReplicationCoordinator::get(_opCtx.getServiceContext())->getSettings()) { auto* const sc = _opCtx.getServiceContext(); - transport::TransportLayerASIO::Options opts; - opts.mode = transport::TransportLayerASIO::Options::kEgress; - sc->setTransportLayer(std::make_unique<transport::TransportLayerASIO>(opts, nullptr)); + transport::AsioTransportLayer::Options opts; + opts.mode = transport::AsioTransportLayer::Options::kEgress; + sc->setTransportLayer(std::make_unique<transport::AsioTransportLayer>(opts, nullptr)); ASSERT_OK(sc->getTransportLayer()->setup()); ASSERT_OK(sc->getTransportLayer()->start()); diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp index 3db269629fc..0041b24db14 100644 --- a/src/mongo/executor/network_interface_integration_test.cpp +++ b/src/mongo/executor/network_interface_integration_test.cpp @@ -500,7 +500,7 @@ TEST_F(NetworkInterfaceTest, LateCancel) { TEST_F(NetworkInterfaceTest, ConnectionErrorDropsSingleConnection) { FailPoint* failPoint = - globalFailPointRegistry().find("transportLayerASIOasyncConnectReturnsConnectionError"); + globalFailPointRegistry().find("asioTransportLayerAsyncConnectReturnsConnectionError"); auto timesEntered = failPoint->setMode(FailPoint::nTimes, 1); auto cbh = makeCallbackHandle(); diff --git a/src/mongo/shell/mongo_main.cpp b/src/mongo/shell/mongo_main.cpp index 585e1adce17..c3dee7a334b 100644 --- a/src/mongo/shell/mongo_main.cpp +++ b/src/mongo/shell/mongo_main.cpp @@ -70,7 +70,7 @@ #include "mongo/shell/shell_utils.h" #include "mongo/shell/shell_utils_launcher.h" #include "mongo/stdx/utility.h" -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/util/ctype.h" #include "mongo/util/errno_util.h" #include "mongo/util/exit.h" @@ -725,12 +725,12 @@ int mongo_main(int argc, char* argv[]) { OCSPManager::start(serviceContext); #endif - transport::TransportLayerASIO::Options opts; + transport::AsioTransportLayer::Options opts; opts.enableIPv6 = shellGlobalParams.enableIPv6; - opts.mode = transport::TransportLayerASIO::Options::kEgress; + opts.mode = transport::AsioTransportLayer::Options::kEgress; serviceContext->setTransportLayer( - std::make_unique<transport::TransportLayerASIO>(opts, nullptr)); + std::make_unique<transport::AsioTransportLayer>(opts, nullptr)); auto tlPtr = serviceContext->getTransportLayer(); uassertStatusOK(tlPtr->setup()); uassertStatusOK(tlPtr->start()); diff --git a/src/mongo/tools/mongobridge_tool/bridge.cpp b/src/mongo/tools/mongobridge_tool/bridge.cpp index db87a9fa0a6..d28f8b3bfd5 100644 --- a/src/mongo/tools/mongobridge_tool/bridge.cpp +++ b/src/mongo/tools/mongobridge_tool/bridge.cpp @@ -50,10 +50,10 @@ #include "mongo/stdx/thread.h" #include "mongo/tools/mongobridge_tool/bridge_commands.h" #include "mongo/tools/mongobridge_tool/mongobridge_options.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/service_entry_point_impl.h" #include "mongo/transport/service_executor_synchronous.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/util/assert_util.h" #include "mongo/util/exit.h" #include "mongo/util/future.h" @@ -509,11 +509,11 @@ int bridgeMain(int argc, char** argv) { serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointBridge>(serviceContext)); { - transport::TransportLayerASIO::Options opts; + transport::AsioTransportLayer::Options opts; opts.ipList.emplace_back("0.0.0.0"); opts.port = mongoBridgeGlobalParams.port; - auto tl = std::make_unique<mongo::transport::TransportLayerASIO>( + auto tl = std::make_unique<mongo::transport::AsioTransportLayer>( opts, serviceContext->getServiceEntryPoint()); serviceContext->setTransportLayer(std::move(tl)); } diff --git a/src/mongo/transport/SConscript b/src/mongo/transport/SConscript index db0304b0cfc..ed708094e8c 100644 --- a/src/mongo/transport/SConscript +++ b/src/mongo/transport/SConscript @@ -69,8 +69,8 @@ tlEnv.Library( tlEnv.Library( target='transport_layer', source=[ - 'transport_layer_asio.cpp', 'asio_session.cpp', + 'asio_transport_layer.cpp', 'asio_utils.cpp', 'baton_asio_linux.cpp' if env.TargetOSIs('linux') else [], 'proxy_protocol_header_parser.cpp', @@ -205,10 +205,10 @@ env.Library( tlEnv.CppUnitTest( target='transport_test', source=[ + 'asio_transport_layer_test.cpp', 'asio_utils_test.cpp', 'message_compressor_manager_test.cpp', 'message_compressor_registry_test.cpp', - 'transport_layer_asio_test.cpp', 'service_executor_test.cpp', 'max_conns_override_test.cpp', 'session_workflow_test.cpp', @@ -251,7 +251,7 @@ tlEnvTest.Append( tlEnvTest.CppIntegrationTest( target='transport_integration_test', source=[ - 'transport_layer_asio_integration_test.cpp', + 'asio_transport_layer_integration_test.cpp', ], LIBDEPS=[ '$BUILD_DIR/mongo/base', diff --git a/src/mongo/transport/asio_session.cpp b/src/mongo/transport/asio_session.cpp index 9f2be532da7..1c5b86218eb 100644 --- a/src/mongo/transport/asio_session.cpp +++ b/src/mongo/transport/asio_session.cpp @@ -44,10 +44,10 @@ namespace mongo::transport { -MONGO_FAIL_POINT_DEFINE(transportLayerASIOshortOpportunisticReadWrite); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOSessionPauseBeforeSetSocketOption); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOBlockBeforeOpportunisticRead); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOBlockBeforeAddSession); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerShortOpportunisticReadWrite); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerSessionPauseBeforeSetSocketOption); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerBlockBeforeOpportunisticRead); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerBlockBeforeAddSession); namespace { @@ -108,8 +108,8 @@ CounterMetric totalIngressTLSHandshakeTimeMillis("network.totalIngressTLSHandsha } // namespace -TransportLayerASIO::AsioSession::AsioSession( - TransportLayerASIO* tl, +AsioTransportLayer::AsioSession::AsioSession( + AsioTransportLayer* tl, GenericSocket socket, bool isIngressSession, Endpoint endpoint, @@ -120,7 +120,7 @@ TransportLayerASIO::AsioSession::AsioSession( auto family = endpointToSockAddr(_socket.local_endpoint()).getType(); auto sev = logv2::LogSeverity::Debug(3); if (family == AF_INET || family == AF_INET6) { - transportLayerASIOSessionPauseBeforeSetSocketOption.pauseWhileSet(); + asioTransportLayerSessionPauseBeforeSetSocketOption.pauseWhileSet(); setSocketOption(_socket, asio::ip::tcp::no_delay(true), "session no delay", sev); setSocketOption(_socket, asio::socket_base::keep_alive(true), "session keep alive", sev); setSocketKeepAliveParams(_socket.native_handle(), sev); @@ -162,7 +162,7 @@ TransportLayerASIO::AsioSession::AsioSession( throw; } -void TransportLayerASIO::AsioSession::end() { +void AsioTransportLayer::AsioSession::end() { if (getSocket().is_open()) { std::error_code ec; getSocket().shutdown(GenericSocket::shutdown_both, ec); @@ -175,14 +175,14 @@ void TransportLayerASIO::AsioSession::end() { } } -StatusWith<Message> TransportLayerASIO::AsioSession::sourceMessage() noexcept try { +StatusWith<Message> AsioTransportLayer::AsioSession::sourceMessage() noexcept try { ensureSync(); return sourceMessageImpl().getNoThrow(); } catch (const DBException& ex) { return ex.toStatus(); } -Future<Message> TransportLayerASIO::AsioSession::asyncSourceMessage( +Future<Message> AsioTransportLayer::AsioSession::asyncSourceMessage( const BatonHandle& baton) noexcept try { ensureAsync(); return sourceMessageImpl(baton); @@ -190,7 +190,7 @@ Future<Message> TransportLayerASIO::AsioSession::asyncSourceMessage( return ex.toStatus(); } -Status TransportLayerASIO::AsioSession::waitForData() noexcept try { +Status AsioTransportLayer::AsioSession::waitForData() noexcept try { ensureSync(); asio::error_code ec; getSocket().wait(asio::ip::tcp::socket::wait_read, ec); @@ -199,21 +199,21 @@ Status TransportLayerASIO::AsioSession::waitForData() noexcept try { return ex.toStatus(); } -Future<void> TransportLayerASIO::AsioSession::asyncWaitForData() noexcept try { +Future<void> AsioTransportLayer::AsioSession::asyncWaitForData() noexcept try { ensureAsync(); return getSocket().async_wait(asio::ip::tcp::socket::wait_read, UseFuture{}); } catch (const DBException& ex) { return ex.toStatus(); } -Status TransportLayerASIO::AsioSession::sinkMessage(Message message) noexcept try { +Status AsioTransportLayer::AsioSession::sinkMessage(Message message) noexcept try { ensureSync(); return sinkMessageImpl(std::move(message)).getNoThrow(); } catch (const DBException& ex) { return ex.toStatus(); } -Future<void> TransportLayerASIO::AsioSession::asyncSinkMessage( +Future<void> AsioTransportLayer::AsioSession::asyncSinkMessage( Message message, const BatonHandle& baton) noexcept try { ensureAsync(); return sinkMessageImpl(std::move(message), baton); @@ -221,7 +221,7 @@ Future<void> TransportLayerASIO::AsioSession::asyncSinkMessage( return ex.toStatus(); } -Future<void> TransportLayerASIO::AsioSession::sinkMessageImpl(Message message, +Future<void> AsioTransportLayer::AsioSession::sinkMessageImpl(Message message, const BatonHandle& baton) { _asyncOpState.start(); return write(asio::buffer(message.buf(), message.size()), baton) @@ -236,7 +236,7 @@ Future<void> TransportLayerASIO::AsioSession::sinkMessageImpl(Message message, }); } -void TransportLayerASIO::AsioSession::cancelAsyncOperations(const BatonHandle& baton) { +void AsioTransportLayer::AsioSession::cancelAsyncOperations(const BatonHandle& baton) { LOGV2_DEBUG(4615608, 3, "Canceling outstanding I/O operations on connection to {remote}", @@ -252,12 +252,12 @@ void TransportLayerASIO::AsioSession::cancelAsyncOperations(const BatonHandle& b getSocket().cancel(); } -void TransportLayerASIO::AsioSession::setTimeout(boost::optional<Milliseconds> timeout) { +void AsioTransportLayer::AsioSession::setTimeout(boost::optional<Milliseconds> timeout) { invariant(!timeout || timeout->count() > 0); _configuredTimeout = timeout; } -bool TransportLayerASIO::AsioSession::isConnected() { +bool AsioTransportLayer::AsioSession::isConnected() { // socket.is_open() only returns whether the socket is a valid file descriptor and // if we haven't marked this socket as closed already. if (!getSocket().is_open()) @@ -297,18 +297,18 @@ bool TransportLayerASIO::AsioSession::isConnected() { } #ifdef MONGO_CONFIG_SSL -const SSLConfiguration* TransportLayerASIO::AsioSession::getSSLConfiguration() const { +const SSLConfiguration* AsioTransportLayer::AsioSession::getSSLConfiguration() const { if (_sslContext->manager) { return &_sslContext->manager->getSSLConfiguration(); } return nullptr; } -std::shared_ptr<SSLManagerInterface> TransportLayerASIO::AsioSession::getSSLManager() const { +std::shared_ptr<SSLManagerInterface> AsioTransportLayer::AsioSession::getSSLManager() const { return _sslContext->manager; } -Status TransportLayerASIO::AsioSession::buildSSLSocket(const HostAndPort& target) { +Status AsioTransportLayer::AsioSession::buildSSLSocket(const HostAndPort& target) { invariant(!_sslSocket, "SSL socket is already constructed"); if (!_sslContext->egress) { return Status(ErrorCodes::SSLHandshakeFailed, "SSL requested but SSL support is disabled"); @@ -317,7 +317,7 @@ Status TransportLayerASIO::AsioSession::buildSSLSocket(const HostAndPort& target return Status::OK(); } -Future<void> TransportLayerASIO::AsioSession::handshakeSSLForEgress(const HostAndPort& target, +Future<void> AsioTransportLayer::AsioSession::handshakeSSLForEgress(const HostAndPort& target, const ReactorHandle& reactor) { invariant(_sslSocket, "SSL Socket expected to be built"); auto doHandshake = [&] { @@ -340,7 +340,7 @@ Future<void> TransportLayerASIO::AsioSession::handshakeSSLForEgress(const HostAn } #endif -void TransportLayerASIO::AsioSession::ensureSync() { +void AsioTransportLayer::AsioSession::ensureSync() { asio::error_code ec; if (_blockingMode != Sync) { getSocket().non_blocking(false, ec); @@ -370,7 +370,7 @@ void TransportLayerASIO::AsioSession::ensureSync() { } } -void TransportLayerASIO::AsioSession::ensureAsync() { +void AsioTransportLayer::AsioSession::ensureAsync() { if (_blockingMode == Async) return; @@ -384,7 +384,7 @@ void TransportLayerASIO::AsioSession::ensureAsync() { _blockingMode = Async; } -auto TransportLayerASIO::AsioSession::getSocket() -> GenericSocket& { +auto AsioTransportLayer::AsioSession::getSocket() -> GenericSocket& { #ifdef MONGO_CONFIG_SSL if (_sslSocket) { return static_cast<GenericSocket&>(_sslSocket->lowest_layer()); @@ -393,7 +393,7 @@ auto TransportLayerASIO::AsioSession::getSocket() -> GenericSocket& { return _socket; } -ExecutorFuture<void> TransportLayerASIO::AsioSession::parseProxyProtocolHeader( +ExecutorFuture<void> AsioTransportLayer::AsioSession::parseProxyProtocolHeader( const ReactorHandle& reactor) { invariant(_isIngressSession); invariant(reactor); @@ -437,7 +437,7 @@ ExecutorFuture<void> TransportLayerASIO::AsioSession::parseProxyProtocolHeader( }); } -Future<Message> TransportLayerASIO::AsioSession::sourceMessageImpl(const BatonHandle& baton) { +Future<Message> AsioTransportLayer::AsioSession::sourceMessageImpl(const BatonHandle& baton) { static constexpr auto kHeaderSize = sizeof(MSGHEADER::Value); auto headerBuffer = SharedBuffer::allocate(kHeaderSize); @@ -492,7 +492,7 @@ Future<Message> TransportLayerASIO::AsioSession::sourceMessageImpl(const BatonHa } template <typename MutableBufferSequence> -Future<void> TransportLayerASIO::AsioSession::read(const MutableBufferSequence& buffers, +Future<void> AsioTransportLayer::AsioSession::read(const MutableBufferSequence& buffers, const BatonHandle& baton) { #ifdef MONGO_CONFIG_SSL if (_sslSocket) { @@ -518,7 +518,7 @@ Future<void> TransportLayerASIO::AsioSession::read(const MutableBufferSequence& } template <typename ConstBufferSequence> -Future<void> TransportLayerASIO::AsioSession::write(const ConstBufferSequence& buffers, +Future<void> AsioTransportLayer::AsioSession::write(const ConstBufferSequence& buffers, const BatonHandle& baton) { #ifdef MONGO_CONFIG_SSL _ranHandshake = true; @@ -542,14 +542,14 @@ Future<void> TransportLayerASIO::AsioSession::write(const ConstBufferSequence& b } template <typename Stream, typename MutableBufferSequence> -Future<void> TransportLayerASIO::AsioSession::opportunisticRead( +Future<void> AsioTransportLayer::AsioSession::opportunisticRead( Stream& stream, const MutableBufferSequence& buffers, const BatonHandle& baton) { std::error_code ec; size_t size; - transportLayerASIOBlockBeforeOpportunisticRead.pauseWhileSet(); + asioTransportLayerBlockBeforeOpportunisticRead.pauseWhileSet(); - if (MONGO_unlikely(transportLayerASIOshortOpportunisticReadWrite.shouldFail()) && + if (MONGO_unlikely(asioTransportLayerShortOpportunisticReadWrite.shouldFail()) && _blockingMode == Async) { asio::mutable_buffer localBuffer = buffers; @@ -585,7 +585,7 @@ Future<void> TransportLayerASIO::AsioSession::opportunisticRead( return makeCanceledStatus(); if (auto networkingBaton = baton ? baton->networking() : nullptr; networkingBaton && networkingBaton->canWait()) { - transportLayerASIOBlockBeforeAddSession.pauseWhileSet(); + asioTransportLayerBlockBeforeAddSession.pauseWhileSet(); return networkingBaton->addSession(*this, NetworkingBaton::Type::In) .onError([](Status error) { if (ErrorCodes::isShutdownError(error)) { @@ -609,19 +609,19 @@ Future<void> TransportLayerASIO::AsioSession::opportunisticRead( } #ifdef MONGO_CONFIG_SSL -boost::optional<std::string> TransportLayerASIO::AsioSession::getSniName() const { +boost::optional<std::string> AsioTransportLayer::AsioSession::getSniName() const { return SSLPeerInfo::forSession(shared_from_this()).sniName; } #endif template <typename Stream, typename ConstBufferSequence> -Future<void> TransportLayerASIO::AsioSession::opportunisticWrite(Stream& stream, +Future<void> AsioTransportLayer::AsioSession::opportunisticWrite(Stream& stream, const ConstBufferSequence& buffers, const BatonHandle& baton) { std::error_code ec; std::size_t size; - if (MONGO_unlikely(transportLayerASIOshortOpportunisticReadWrite.shouldFail()) && + if (MONGO_unlikely(asioTransportLayerShortOpportunisticReadWrite.shouldFail()) && _blockingMode == Async) { asio::const_buffer localBuffer = buffers; @@ -661,7 +661,7 @@ Future<void> TransportLayerASIO::AsioSession::opportunisticWrite(Stream& stream, return makeCanceledStatus(); if (auto networkingBaton = baton ? baton->networking() : nullptr; networkingBaton && networkingBaton->canWait()) { - transportLayerASIOBlockBeforeAddSession.pauseWhileSet(); + asioTransportLayerBlockBeforeAddSession.pauseWhileSet(); return networkingBaton->addSession(*this, NetworkingBaton::Type::Out) .onError([](Status error) { if (ErrorCodes::isShutdownError(error)) { @@ -686,7 +686,7 @@ Future<void> TransportLayerASIO::AsioSession::opportunisticWrite(Stream& stream, #ifdef MONGO_CONFIG_SSL template <typename MutableBufferSequence> -Future<bool> TransportLayerASIO::AsioSession::maybeHandshakeSSLForIngress( +Future<bool> AsioTransportLayer::AsioSession::maybeHandshakeSSLForIngress( const MutableBufferSequence& buffer) { invariant(asio::buffer_size(buffer) >= sizeof(MSGHEADER::Value)); MSGHEADER::ConstView headerView(asio::buffer_cast<char*>(buffer)); @@ -776,13 +776,13 @@ Future<bool> TransportLayerASIO::AsioSession::maybeHandshakeSSLForIngress( #endif // MONGO_CONFIG_SSL template <typename Buffer> -bool TransportLayerASIO::AsioSession::checkForHTTPRequest(const Buffer& buffers) { +bool AsioTransportLayer::AsioSession::checkForHTTPRequest(const Buffer& buffers) { invariant(asio::buffer_size(buffers) >= 4); const StringData bufferAsStr(asio::buffer_cast<const char*>(buffers), 4); return (bufferAsStr == "GET "_sd); } -Future<Message> TransportLayerASIO::AsioSession::sendHTTPResponse(const BatonHandle& baton) { +Future<Message> AsioTransportLayer::AsioSession::sendHTTPResponse(const BatonHandle& baton) { constexpr auto userMsg = "It looks like you are trying to access MongoDB over HTTP" " on the native driver port.\r\n"_sd; diff --git a/src/mongo/transport/asio_session.h b/src/mongo/transport/asio_session.h index 993a726c2c8..c85554683dc 100644 --- a/src/mongo/transport/asio_session.h +++ b/src/mongo/transport/asio_session.h @@ -35,10 +35,10 @@ #include "mongo/config.h" #include "mongo/db/stats/counters.h" #include "mongo/stdx/mutex.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/asio_utils.h" #include "mongo/transport/baton.h" #include "mongo/transport/ssl_connection_context.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/util/fail_point.h" #include "mongo/util/net/socket_utils.h" #ifdef MONGO_CONFIG_SSL @@ -54,8 +54,8 @@ namespace mongo::transport { -extern FailPoint transportLayerASIOshortOpportunisticReadWrite; -extern FailPoint transportLayerASIOSessionPauseBeforeSetSocketOption; +extern FailPoint asioTransportLayerShortOpportunisticReadWrite; +extern FailPoint asioTransportLayerSessionPauseBeforeSetSocketOption; template <typename SuccessValue> auto futurize(const std::error_code& ec, SuccessValue&& successValue) { @@ -76,7 +76,7 @@ inline Future<void> futurize(const std::error_code& ec) { return Result::makeReady(); } -class TransportLayerASIO::AsioSession final : public Session { +class AsioTransportLayer::AsioSession final : public Session { public: using GenericSocket = asio::generic::stream_protocol::socket; @@ -84,7 +84,7 @@ public: // If the socket is disconnected while any of these options are being set, this constructor // may throw, but it is guaranteed to throw a mongo DBException. - AsioSession(TransportLayerASIO* tl, + AsioSession(AsioTransportLayer* tl, GenericSocket socket, bool isIngressSession, Endpoint endpoint = Endpoint(), @@ -149,8 +149,8 @@ public: #endif protected: - friend class TransportLayerASIO; - friend TransportLayerASIO::BatonASIO; + friend class AsioTransportLayer; + friend AsioTransportLayer::BatonASIO; #ifdef MONGO_CONFIG_SSL // Constructs a SSL socket required to initiate SSL handshake for egress connections. @@ -302,7 +302,7 @@ private: std::shared_ptr<const SSLConnectionContext> _sslContext; #endif - TransportLayerASIO* const _tl; + AsioTransportLayer* const _tl; bool _isIngressSession; bool _isFromLoadBalancer = false; boost::optional<SockAddr> _proxiedSrcEndpoint; diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/asio_transport_layer.cpp index 7b10eef3f70..e96df2dc36d 100644 --- a/src/mongo/transport/transport_layer_asio.cpp +++ b/src/mongo/transport/asio_transport_layer.cpp @@ -30,7 +30,7 @@ #include "mongo/platform/basic.h" -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #include <fmt/format.h> #include <fstream> @@ -121,11 +121,11 @@ bool tcpFastOpenIsConfigured = false; boost::optional<Status> maybeTcpFastOpenStatus; } // namespace -MONGO_FAIL_POINT_DEFINE(transportLayerASIOasyncConnectTimesOut); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOdelayConnection); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOhangBeforeAcceptCallback); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOhangDuringAcceptCallback); -MONGO_FAIL_POINT_DEFINE(transportLayerASIOasyncConnectReturnsConnectionError); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerAsyncConnectTimesOut); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerDelayConnection); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerHangBeforeAcceptCallback); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerHangDuringAcceptCallback); +MONGO_FAIL_POINT_DEFINE(asioTransportLayerAsyncConnectReturnsConnectionError); #ifdef MONGO_CONFIG_SSL SSLConnectionContext::~SSLConnectionContext() = default; @@ -207,7 +207,7 @@ private: std::shared_ptr<TimerType> _timer; }; -class TransportLayerASIO::ASIOReactor final : public Reactor { +class AsioTransportLayer::ASIOReactor final : public Reactor { public: ASIOReactor() : _clkSource(this), _stats(&_clkSource), _ioContext() {} @@ -286,7 +286,7 @@ private: class ThreadIdGuard { public: - ThreadIdGuard(TransportLayerASIO::ASIOReactor* reactor) { + ThreadIdGuard(AsioTransportLayer::ASIOReactor* reactor) { invariant(!_reactorForThread); _reactorForThread = reactor; } @@ -306,10 +306,10 @@ private: asio::io_context _ioContext; }; -thread_local TransportLayerASIO::ASIOReactor* TransportLayerASIO::ASIOReactor::_reactorForThread = +thread_local AsioTransportLayer::ASIOReactor* AsioTransportLayer::ASIOReactor::_reactorForThread = nullptr; -TransportLayerASIO::Options::Options(const ServerGlobalParams* params, +AsioTransportLayer::Options::Options(const ServerGlobalParams* params, boost::optional<int> loadBalancerPort) : port(params->port), loadBalancerPort(loadBalancerPort), @@ -321,17 +321,17 @@ TransportLayerASIO::Options::Options(const ServerGlobalParams* params, maxConns(params->maxConns) { } -TransportLayerASIO::TimerService::TimerService(Options opt) - : _reactor(std::make_shared<TransportLayerASIO::ASIOReactor>()) { +AsioTransportLayer::TimerService::TimerService(Options opt) + : _reactor(std::make_shared<AsioTransportLayer::ASIOReactor>()) { if (opt.spawn) _spawn = std::move(opt.spawn); } -TransportLayerASIO::TimerService::~TimerService() { +AsioTransportLayer::TimerService::~TimerService() { stop(); } -void TransportLayerASIO::TimerService::start() { +void AsioTransportLayer::TimerService::start() { // Skip the expensive lock acquisition and `compareAndSwap` in the common path. if (MONGO_likely(_state.load() != State::kInitialized)) return; @@ -357,7 +357,7 @@ void TransportLayerASIO::TimerService::start() { } } -void TransportLayerASIO::TimerService::stop() { +void AsioTransportLayer::TimerService::stop() { // It's possible for `stop()` to be called without `start()` having been called (or for them to // be called concurrently), so we only proceed with stopping the reactor and joining the thread // if we've already transitioned to the `kStarted` state. @@ -369,22 +369,22 @@ void TransportLayerASIO::TimerService::stop() { _thread.join(); } -std::unique_ptr<ReactorTimer> TransportLayerASIO::TimerService::makeTimer() { +std::unique_ptr<ReactorTimer> AsioTransportLayer::TimerService::makeTimer() { return _getReactor()->makeTimer(); } -Date_t TransportLayerASIO::TimerService::now() { +Date_t AsioTransportLayer::TimerService::now() { return _getReactor()->now(); } -Reactor* TransportLayerASIO::TimerService::_getReactor() { - // TODO SERVER-57253 We can start this service as part of starting `TransportLayerASIO`. +Reactor* AsioTransportLayer::TimerService::_getReactor() { + // TODO SERVER-57253 We can start this service as part of starting `AsioTransportLayer`. // Then, we can remove the following invocation of `start()`. start(); return _reactor.get(); } -TransportLayerASIO::TransportLayerASIO(const TransportLayerASIO::Options& opts, +AsioTransportLayer::AsioTransportLayer(const AsioTransportLayer::Options& opts, ServiceEntryPoint* sep, const WireSpec& wireSpec) : TransportLayer(wireSpec), @@ -395,9 +395,9 @@ TransportLayerASIO::TransportLayerASIO(const TransportLayerASIO::Options& opts, _listenerOptions(opts), _timerService(std::make_unique<TimerService>()) {} -TransportLayerASIO::~TransportLayerASIO() = default; +AsioTransportLayer::~AsioTransportLayer() = default; -struct TransportLayerASIO::AcceptorRecord { +struct AsioTransportLayer::AcceptorRecord { AcceptorRecord(SockAddr address, GenericAcceptor acceptor) : address(std::move(address)), acceptor(std::move(acceptor)) {} @@ -588,7 +588,7 @@ Status makeConnectError(Status status, const HostAndPort& peer, const WrappedEnd } -StatusWith<SessionHandle> TransportLayerASIO::connect( +StatusWith<SessionHandle> AsioTransportLayer::connect( HostAndPort peer, ConnectSSLMode sslMode, Milliseconds timeout, @@ -699,7 +699,7 @@ StatusWith<SessionHandle> TransportLayerASIO::connect( } template <typename Endpoint> -StatusWith<TransportLayerASIO::AsioSessionHandle> TransportLayerASIO::_doSyncConnect( +StatusWith<AsioTransportLayer::AsioSessionHandle> AsioTransportLayer::_doSyncConnect( Endpoint endpoint, const HostAndPort& peer, const Milliseconds& timeout, @@ -772,14 +772,14 @@ StatusWith<TransportLayerASIO::AsioSessionHandle> TransportLayerASIO::_doSyncCon } } -Future<SessionHandle> TransportLayerASIO::asyncConnect( +Future<SessionHandle> AsioTransportLayer::asyncConnect( HostAndPort peer, ConnectSSLMode sslMode, const ReactorHandle& reactor, Milliseconds timeout, std::shared_ptr<ConnectionMetrics> connectionMetrics, std::shared_ptr<const SSLConnectionContext> transientSSLContext) { - if (MONGO_unlikely(transportLayerASIOasyncConnectReturnsConnectionError.shouldFail())) + if (MONGO_unlikely(asioTransportLayerAsyncConnectReturnsConnectionError.shouldFail())) return Status{ErrorCodes::ConnectionError, "Failing asyncConnect due to fail-point"}; invariant(connectionMetrics); @@ -814,7 +814,7 @@ Future<SessionHandle> TransportLayerASIO::asyncConnect( WrappedResolver resolver; WrappedEndpoint resolvedEndpoint; const HostAndPort peer; - TransportLayerASIO::AsioSessionHandle session; + AsioTransportLayer::AsioSessionHandle session; ReactorHandle reactor; }; @@ -854,7 +854,7 @@ Future<SessionHandle> TransportLayerASIO::asyncConnect( Date_t timeBefore = Date_t::now(); auto resolverFuture = [&]() { - if (auto sfp = transportLayerASIOdelayConnection.scoped(); MONGO_unlikely(sfp.isActive())) { + if (auto sfp = asioTransportLayerDelayConnection.scoped(); MONGO_unlikely(sfp.isActive())) { Milliseconds delay{sfp.getData()["millis"].safeNumberInt()}; Date_t deadline = reactor->now() + delay; if ((delay > Milliseconds(0)) && (deadline < Date_t::max())) { @@ -964,7 +964,7 @@ Future<SessionHandle> TransportLayerASIO::asyncConnect( return makeConnectError(status, connector->peer, connector->resolvedEndpoint); }) .getAsync([connector](Status connectResult) { - if (MONGO_unlikely(transportLayerASIOasyncConnectTimesOut.shouldFail())) { + if (MONGO_unlikely(asioTransportLayerAsyncConnectTimesOut.shouldFail())) { LOGV2(23013, "asyncConnectTimesOut fail point is active. simulating timeout."); return; } @@ -1128,7 +1128,7 @@ Status validateFastOpenOnce() noexcept { } } // namespace -Status TransportLayerASIO::setup() { +Status AsioTransportLayer::setup() { std::vector<std::string> listenAddrs; if (_listenerOptions.ipList.empty() && _listenerOptions.isIngress()) { listenAddrs = {"127.0.0.1"}; @@ -1318,7 +1318,7 @@ Status TransportLayerASIO::setup() { return Status::OK(); } -std::vector<std::pair<SockAddr, int>> TransportLayerASIO::getListenerSocketBacklogQueueDepths() +std::vector<std::pair<SockAddr, int>> AsioTransportLayer::getListenerSocketBacklogQueueDepths() const { std::vector<std::pair<SockAddr, int>> queueDepths; for (auto&& record : _acceptorRecords) { @@ -1327,13 +1327,13 @@ std::vector<std::pair<SockAddr, int>> TransportLayerASIO::getListenerSocketBackl return queueDepths; } -void TransportLayerASIO::appendStatsForServerStatus(BSONObjBuilder* bob) const { +void AsioTransportLayer::appendStatsForServerStatus(BSONObjBuilder* bob) const { if (gFeatureFlagConnHealthMetrics.isEnabledAndIgnoreFCV()) { bob->append("listenerProcessingTime", _listenerProcessingTime.load().toBSON()); } } -void TransportLayerASIO::appendStatsForFTDC(BSONObjBuilder& bob) const { +void AsioTransportLayer::appendStatsForFTDC(BSONObjBuilder& bob) const { if (gFeatureFlagConnHealthMetrics.isEnabledAndIgnoreFCV()) { BSONArrayBuilder queueDepthsArrayBuilder( bob.subarrayStart("listenerSocketBacklogQueueDepths")); @@ -1345,7 +1345,7 @@ void TransportLayerASIO::appendStatsForFTDC(BSONObjBuilder& bob) const { } } -void TransportLayerASIO::_runListener() noexcept { +void AsioTransportLayer::_runListener() noexcept { setThreadName("listener"); stdx::unique_lock lk(_mutex); @@ -1410,7 +1410,7 @@ void TransportLayerASIO::_runListener() noexcept { } } -Status TransportLayerASIO::start() { +Status AsioTransportLayer::start() { stdx::unique_lock lk(_mutex); if (_isShutdown) { LOGV2(6986801, "Cannot start an already shutdown TransportLayer"); @@ -1427,7 +1427,7 @@ Status TransportLayerASIO::start() { return Status::OK(); } -void TransportLayerASIO::shutdown() { +void AsioTransportLayer::shutdown() { stdx::unique_lock lk(_mutex); if (std::exchange(_isShutdown, true)) { @@ -1461,7 +1461,7 @@ void TransportLayerASIO::shutdown() { thread.join(); } -ReactorHandle TransportLayerASIO::getReactor(WhichReactor which) { +ReactorHandle AsioTransportLayer::getReactor(WhichReactor which) { switch (which) { case TransportLayer::kIngress: return _ingressReactor; @@ -1492,11 +1492,11 @@ bool isTcp(Protocol&& p) { } } // namespace -void TransportLayerASIO::_acceptConnection(GenericAcceptor& acceptor) { +void AsioTransportLayer::_acceptConnection(GenericAcceptor& acceptor) { auto acceptCb = [this, &acceptor](const std::error_code& ec, AsioSession::GenericSocket peerSocket) mutable { Timer timer; - transportLayerASIOhangDuringAcceptCallback.pauseWhileSet(); + asioTransportLayerHangDuringAcceptCallback.pauseWhileSet(); if (auto lk = stdx::lock_guard(_mutex); _isShutdown) { return; @@ -1556,14 +1556,14 @@ void TransportLayerASIO::_acceptConnection(GenericAcceptor& acceptor) { _acceptConnection(acceptor); }; - transportLayerASIOhangBeforeAcceptCallback.pauseWhileSet(); + asioTransportLayerHangBeforeAcceptCallback.pauseWhileSet(); _trySetListenerSocketBacklogQueueDepth(acceptor); acceptor.async_accept(*_ingressReactor, std::move(acceptCb)); } -void TransportLayerASIO::_trySetListenerSocketBacklogQueueDepth( +void AsioTransportLayer::_trySetListenerSocketBacklogQueueDepth( GenericAcceptor& acceptor) noexcept { #ifdef __linux__ try { @@ -1589,11 +1589,11 @@ void TransportLayerASIO::_trySetListenerSocketBacklogQueueDepth( } #ifdef MONGO_CONFIG_SSL -SSLParams::SSLModes TransportLayerASIO::_sslMode() const { +SSLParams::SSLModes AsioTransportLayer::_sslMode() const { return static_cast<SSLParams::SSLModes>(getSSLGlobalParams().sslMode.load()); } -Status TransportLayerASIO::rotateCertificates(std::shared_ptr<SSLManagerInterface> manager, +Status AsioTransportLayer::rotateCertificates(std::shared_ptr<SSLManagerInterface> manager, bool asyncOCSPStaple) { if (manager && manager->isTransient()) { return Status(ErrorCodes::InternalError, @@ -1608,7 +1608,7 @@ Status TransportLayerASIO::rotateCertificates(std::shared_ptr<SSLManagerInterfac } StatusWith<std::shared_ptr<const transport::SSLConnectionContext>> -TransportLayerASIO::_createSSLContext(std::shared_ptr<SSLManagerInterface>& manager, +AsioTransportLayer::_createSSLContext(std::shared_ptr<SSLManagerInterface>& manager, SSLParams::SSLModes sslMode, bool asyncOCSPStaple) const { @@ -1657,7 +1657,7 @@ TransportLayerASIO::_createSSLContext(std::shared_ptr<SSLManagerInterface>& mana } StatusWith<std::shared_ptr<const transport::SSLConnectionContext>> -TransportLayerASIO::createTransientSSLContext(const TransientSSLParams& transientSSLParams) { +AsioTransportLayer::createTransientSSLContext(const TransientSSLParams& transientSSLParams) { auto coordinator = SSLManagerCoordinator::get(); if (!coordinator) { return Status(ErrorCodes::InvalidSSLConfiguration, @@ -1672,7 +1672,7 @@ TransportLayerASIO::createTransientSSLContext(const TransientSSLParams& transien #endif #ifdef __linux__ -BatonHandle TransportLayerASIO::makeBaton(OperationContext* opCtx) const { +BatonHandle AsioTransportLayer::makeBaton(OperationContext* opCtx) const { invariant(!opCtx->getBaton()); auto baton = std::make_shared<BatonASIO>(opCtx); diff --git a/src/mongo/transport/transport_layer_asio.h b/src/mongo/transport/asio_transport_layer.h index b2cd9eccb56..b428c514347 100644 --- a/src/mongo/transport/transport_layer_asio.h +++ b/src/mongo/transport/asio_transport_layer.h @@ -69,22 +69,22 @@ class ServiceEntryPoint; namespace transport { // Simulates reads and writes that always return 1 byte and fail with EAGAIN -extern FailPoint transportLayerASIOshortOpportunisticReadWrite; +extern FailPoint asioTransportLayerShortOpportunisticReadWrite; // Cause an asyncConnect to timeout after it's successfully connected to the remote peer -extern FailPoint transportLayerASIOasyncConnectTimesOut; +extern FailPoint asioTransportLayerAsyncConnectTimesOut; -extern FailPoint transportLayerASIOhangBeforeAcceptCallback; +extern FailPoint asioTransportLayerHangBeforeAcceptCallback; -extern FailPoint transportLayerASIOhangDuringAcceptCallback; +extern FailPoint asioTransportLayerHangDuringAcceptCallback; /** * A TransportLayer implementation based on ASIO networking primitives. */ -class TransportLayerASIO final : public TransportLayer { - TransportLayerASIO(const TransportLayerASIO&) = delete; - TransportLayerASIO& operator=(const TransportLayerASIO&) = delete; +class AsioTransportLayer final : public TransportLayer { + AsioTransportLayer(const AsioTransportLayer&) = delete; + AsioTransportLayer& operator=(const AsioTransportLayer&) = delete; public: constexpr static auto kSlowOperationThreshold = Seconds(1); @@ -118,7 +118,7 @@ public: }; /** - * A service, internal to `TransportLayerASIO`, that allows creating timers and running `Future` + * A service, internal to `AsioTransportLayer`, that allows creating timers and running `Future` * continuations when a timeout occurs. This allows setting up timeouts for synchronous * operations, such as a synchronous SSL handshake. A separate thread is assigned to run these * timers to: @@ -126,7 +126,7 @@ public: * asynchronous listener. * - Avoid any performance implications on other reactors (e.g., the `egressReactor`). * The public visibility is only for testing purposes and this service is not intended to be - * used outside `TransportLayerASIO`. + * used outside `AsioTransportLayer`. */ class TimerService { public: @@ -163,7 +163,7 @@ public: // Serializes invocations of `start()` and `stop()`, and allows updating `_state` and // `_thread` as a single atomic operation. - Mutex _mutex = MONGO_MAKE_LATCH("TransportLayerASIO::TimerService::_mutex"); + Mutex _mutex = MONGO_MAKE_LATCH("AsioTransportLayer::TimerService::_mutex"); // State transitions: `kInitialized` --> `kStarted` --> `kStopped` // |_______________________________^ @@ -174,11 +174,11 @@ public: stdx::thread _thread; }; - TransportLayerASIO(const Options& opts, + AsioTransportLayer(const Options& opts, ServiceEntryPoint* sep, const WireSpec& wireSpec = WireSpec::instance()); - ~TransportLayerASIO() override; + ~AsioTransportLayer() override; StatusWith<SessionHandle> connect(HostAndPort peer, ConnectSSLMode sslMode, @@ -264,20 +264,20 @@ private: SSLParams::SSLModes _sslMode() const; #endif - Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "TransportLayerASIO::_mutex"); + Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "AsioTransportLayer::_mutex"); - // There are three reactors that are used by TransportLayerASIO. The _ingressReactor contains + // There are three reactors that are used by AsioTransportLayer. The _ingressReactor contains // all the accepted sockets and all ingress networking activity. The _acceptorReactor contains // all the sockets in _acceptors. The _egressReactor contains egress connections. // - // TransportLayerASIO should never call run() on the _ingressReactor. + // AsioTransportLayer should never call run() on the _ingressReactor. // In synchronous mode, this will cause a massive performance degradation due to // unnecessary wakeups on the asio thread for sockets we don't intend to interact // with asynchronously. The additional IO context avoids registering those sockets // with the acceptors epoll set, thus avoiding those wakeups. Calling run will // undo that benefit. // - // TransportLayerASIO should run its own thread that calls run() on the _acceptorReactor + // AsioTransportLayer should run its own thread that calls run() on the _acceptorReactor // to process calls to async_accept - this is the equivalent of the "listener" thread in // other TransportLayers. // diff --git a/src/mongo/transport/transport_layer_asio_integration_test.cpp b/src/mongo/transport/asio_transport_layer_integration_test.cpp index 912065c8821..e1130778b8c 100644 --- a/src/mongo/transport/transport_layer_asio_integration_test.cpp +++ b/src/mongo/transport/asio_transport_layer_integration_test.cpp @@ -40,9 +40,9 @@ #include "mongo/logv2/log.h" #include "mongo/rpc/topology_version_gen.h" #include "mongo/stdx/thread.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/unittest/integration_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point.h" @@ -55,7 +55,7 @@ namespace mongo { namespace { -TEST(TransportLayerASIO, HTTPRequestGetsHTTPError) { +TEST(AsioTransportLayer, HTTPRequestGetsHTTPError) { auto connectionString = unittest::getFixtureConnectionString(); auto server = connectionString.getServers().front(); @@ -101,7 +101,7 @@ TEST(TransportLayerASIO, HTTPRequestGetsHTTPError) { // // Because of the file size limit, it's only an effective check on debug builds (where the future // implementation checks the length of the future chain). -TEST(TransportLayerASIO, ShortReadsAndWritesWork) { +TEST(AsioTransportLayer, ShortReadsAndWritesWork) { const auto assertOK = [](executor::RemoteCommandResponse reply) { ASSERT_OK(reply.status); ASSERT(reply.data["ok"]) << reply.data; @@ -127,7 +127,7 @@ TEST(TransportLayerASIO, ShortReadsAndWritesWork) { handle->initWireVersion(__FILE__, nullptr).get(); - FailPointEnableBlock fp("transportLayerASIOshortOpportunisticReadWrite"); + FailPointEnableBlock fp("asioTransportLayerShortOpportunisticReadWrite"); const executor::RemoteCommandRequest ecr{ server, "admin", BSON("echo" << std::string(1 << 10, 'x')), BSONObj(), nullptr}; @@ -140,7 +140,7 @@ TEST(TransportLayerASIO, ShortReadsAndWritesWork) { handle->runCommandRequest(ecr, opCtx->getBaton()).get(opCtx.get()); } -TEST(TransportLayerASIO, asyncConnectTimeoutCleansUpSocket) { +TEST(AsioTransportLayer, asyncConnectTimeoutCleansUpSocket) { auto connectionString = unittest::getFixtureConnectionString(); auto server = connectionString.getServers().front(); @@ -154,7 +154,7 @@ TEST(TransportLayerASIO, asyncConnectTimeoutCleansUpSocket) { thread.join(); }); - FailPointEnableBlock fp("transportLayerASIOasyncConnectTimesOut"); + FailPointEnableBlock fp("asioTransportLayerAsyncConnectTimesOut"); auto metrics = std::make_shared<ConnectionMetrics>(sc->getFastClockSource()); auto client = AsyncDBClient::connect( server, transport::kGlobalSSLMode, sc, reactor, Milliseconds{500}, metrics) @@ -162,7 +162,7 @@ TEST(TransportLayerASIO, asyncConnectTimeoutCleansUpSocket) { ASSERT_EQ(client.getStatus(), ErrorCodes::NetworkTimeout); } -TEST(TransportLayerASIO, exhaustIsMasterShouldReceiveMultipleReplies) { +TEST(AsioTransportLayer, exhaustIsMasterShouldReceiveMultipleReplies) { auto connectionString = unittest::getFixtureConnectionString(); auto server = connectionString.getServers().front(); @@ -241,7 +241,7 @@ TEST(TransportLayerASIO, exhaustIsMasterShouldReceiveMultipleReplies) { } } -TEST(TransportLayerASIO, exhaustIsMasterShouldStopOnFailure) { +TEST(AsioTransportLayer, exhaustIsMasterShouldStopOnFailure) { const auto assertOK = [](executor::RemoteCommandResponse reply) { ASSERT_OK(reply.status); ASSERT(reply.data["ok"]) << reply.data; diff --git a/src/mongo/transport/transport_layer_asio_test.cpp b/src/mongo/transport/asio_transport_layer_test.cpp index a53a0bbebda..cefaebe0929 100644 --- a/src/mongo/transport/transport_layer_asio_test.cpp +++ b/src/mongo/transport/asio_transport_layer_test.cpp @@ -27,7 +27,7 @@ * it in the license file. */ -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #include <fstream> #include <queue> @@ -287,24 +287,24 @@ private: synchronized_value<std::vector<std::unique_ptr<SessionThread>>> _sessions; }; -std::unique_ptr<transport::TransportLayerASIO> makeTLA(ServiceEntryPoint* sep) { +std::unique_ptr<transport::AsioTransportLayer> makeTLA(ServiceEntryPoint* sep) { auto options = [] { ServerGlobalParams params; params.noUnixSocket = true; - transport::TransportLayerASIO::Options opts(¶ms); + transport::AsioTransportLayer::Options opts(¶ms); // TODO SERVER-30312 should clean this up and assign a port from the supplied port range // provided by resmoke. opts.port = 0; return opts; }(); - auto tla = std::make_unique<transport::TransportLayerASIO>(options, sep); + auto tla = std::make_unique<transport::AsioTransportLayer>(options, sep); ASSERT_OK(tla->setup()); ASSERT_OK(tla->start()); return tla; } /** - * Properly setting up and tearing down the MockSEP and TransportLayerASIO is + * Properly setting up and tearing down the MockSEP and AsioTransportLayer is * tricky. Most tests can delegate the details to this TestFixture. */ class TestFixture { @@ -320,7 +320,7 @@ public: return _sep; } - transport::TransportLayerASIO& tla() { + transport::AsioTransportLayer& tla() { return *_tla; } @@ -349,24 +349,24 @@ public: private: RAIIServerParameterControllerForTest _featureFlagController{"featureFlagConnHealthMetrics", true}; - std::unique_ptr<transport::TransportLayerASIO> _tla; + std::unique_ptr<transport::AsioTransportLayer> _tla; MockSEP _sep; - FailPoint& _hangBeforeAccept = transport::transportLayerASIOhangBeforeAcceptCallback; - FailPoint& _hangDuringAccept = transport::transportLayerASIOhangDuringAcceptCallback; + FailPoint& _hangBeforeAccept = transport::asioTransportLayerHangBeforeAcceptCallback; + FailPoint& _hangDuringAccept = transport::asioTransportLayerHangDuringAcceptCallback; FailPoint::EntryCountT _hangBeforeAcceptTimesEntered{0}; FailPoint::EntryCountT _hangDuringAcceptTimesEntered{0}; }; -TEST(TransportLayerASIO, ListenerPortZeroTreatedAsEphemeral) { +TEST(AsioTransportLayer, ListenerPortZeroTreatedAsEphemeral) { Notification<bool> connected; TestFixture tf; tf.sep().setOnStartSession([&](auto&&) { connected.set(true); }); int port = tf.tla().listenerPort(); ASSERT_GT(port, 0); - LOGV2(6109514, "TransportLayerASIO listening", "port"_attr = port); + LOGV2(6109514, "AsioTransportLayer listening", "port"_attr = port); ConnectionThread connectThread(port); connected.get(); @@ -389,14 +389,14 @@ void setNoLinger(ConnectionThread& conn) { * Test that the server appropriately handles a client-side socket disconnection, and that the * client sends an RST packet when the socket is forcibly closed. */ -TEST(TransportLayerASIO, TCPResetAfterConnectionIsSilentlySwallowed) { +TEST(AsioTransportLayer, TCPResetAfterConnectionIsSilentlySwallowed) { TestFixture tf; AtomicWord<int> sessionsCreated{0}; tf.sep().setOnStartSession([&](auto&&) { sessionsCreated.fetchAndAdd(1); }); LOGV2(6109515, "connecting"); - auto& fp = transport::transportLayerASIOhangDuringAcceptCallback; + auto& fp = transport::asioTransportLayerHangDuringAcceptCallback; auto timesEntered = fp.setMode(FailPoint::alwaysOn); ConnectionThread connectThread(tf.tla().listenerPort(), &setNoLinger); fp.waitForTimesEntered(timesEntered + 1); @@ -414,9 +414,9 @@ TEST(TransportLayerASIO, TCPResetAfterConnectionIsSilentlySwallowed) { #ifdef __linux__ /** * Test that the server successfully captures the TCP socket queue depth, and places the value both - * into the TransportLayerASIO class and FTDC output. + * into the AsioTransportLayer class and FTDC output. */ -TEST(TransportLayerASIO, TCPCheckQueueDepth) { +TEST(AsioTransportLayer, TCPCheckQueueDepth) { // Set the listenBacklog to a parameter greater than the number of connection threads we intend // to create. serverGlobalParams.listenBacklog = 10; @@ -464,7 +464,7 @@ TEST(TransportLayerASIO, TCPCheckQueueDepth) { } #endif -TEST(TransportLayerASIO, ThrowOnNetworkErrorInEnsureSync) { +TEST(AsioTransportLayer, ThrowOnNetworkErrorInEnsureSync) { TestFixture tf; Notification<SessionThread*> mockSessionCreated; tf.sep().setOnStartSession([&](SessionThread& st) { mockSessionCreated.set(&st); }); @@ -490,7 +490,7 @@ TEST(TransportLayerASIO, ThrowOnNetworkErrorInEnsureSync) { } /* check that timeouts actually time out */ -TEST(TransportLayerASIO, SourceSyncTimeoutTimesOut) { +TEST(AsioTransportLayer, SourceSyncTimeoutTimesOut) { TestFixture tf; Notification<StatusWith<Message>> received; tf.sep().setOnStartSession([&](SessionThread& st) { @@ -502,7 +502,7 @@ TEST(TransportLayerASIO, SourceSyncTimeoutTimesOut) { } /* check that timeouts don't time out unless there's an actual timeout */ -TEST(TransportLayerASIO, SourceSyncTimeoutSucceeds) { +TEST(AsioTransportLayer, SourceSyncTimeoutSucceeds) { TestFixture tf; Notification<StatusWith<Message>> received; tf.sep().setOnStartSession([&](SessionThread& st) { @@ -515,7 +515,7 @@ TEST(TransportLayerASIO, SourceSyncTimeoutSucceeds) { } /** Switching from timeouts to no timeouts must reset the timeout to unlimited. */ -TEST(TransportLayerASIO, SwitchTimeoutModes) { +TEST(AsioTransportLayer, SwitchTimeoutModes) { TestFixture tf; Notification<SessionThread*> mockSessionCreated; tf.sep().setOnStartSession([&](SessionThread& st) { mockSessionCreated.set(&st); }); @@ -601,12 +601,12 @@ private: }; /** - * Have `TransportLayerASIO` make a egress connection and observe behavior when + * Have `AsioTransportLayer` make a egress connection and observe behavior when * that connection is immediately reset by the peer. Test that if this happens * during the `AsioSession` constructor, that the thrown `asio::system_error` * is handled safely (translated to a Status holding a SocketException). */ -TEST(TransportLayerASIO, EgressConnectionResetByPeerDuringSessionCtor) { +TEST(AsioTransportLayer, EgressConnectionResetByPeerDuringSessionCtor) { // Under TFO, no SYN is sent until the client has data to send. For this // test, we need the server to respond when the client hits the failpoint // in the AsioSession ctor. So we have to disable TFO. @@ -618,7 +618,7 @@ TEST(TransportLayerASIO, EgressConnectionResetByPeerDuringSessionCtor) { // `fp` pauses the `AsioSession` constructor immediately prior to its // `setsockopt` sequence, to allow time for the peer reset to propagate. - FailPoint& fp = transport::transportLayerASIOSessionPauseBeforeSetSocketOption; + FailPoint& fp = transport::asioTransportLayerSessionPauseBeforeSetSocketOption; Acceptor server(ioContext); server.setOnAccept([&](std::shared_ptr<Acceptor::Connection> conn) { @@ -651,7 +651,7 @@ TEST(TransportLayerASIO, EgressConnectionResetByPeerDuringSessionCtor) { * With no regard to mongo code, just check what the ASIO socket * implementation does in the reset connection scenario. */ -TEST(TransportLayerASIO, ConfirmSocketSetOptionOnResetConnections) { +TEST(AsioTransportLayer, ConfirmSocketSetOptionOnResetConnections) { asio::io_context ioContext; Acceptor server{ioContext}; Notification<bool> accepted; @@ -688,7 +688,7 @@ TEST(TransportLayerASIO, ConfirmSocketSetOptionOnResetConnections) { "msg"_attr = "{}"_format(thrown ? thrown->message() : "")); } -class TransportLayerASIOWithServiceContextTest : public ServiceContextTest { +class AsioTransportLayerWithServiceContextTest : public ServiceContextTest { public: class ThreadCounter { public: @@ -747,21 +747,21 @@ public: getServiceContext()->getTransportLayer()->shutdown(); } - transport::TransportLayerASIO& tla() { + transport::AsioTransportLayer& tla() { auto tl = getServiceContext()->getTransportLayer(); - return *dynamic_cast<transport::TransportLayerASIO*>(tl); + return *dynamic_cast<transport::AsioTransportLayer*>(tl); } }; -TEST_F(TransportLayerASIOWithServiceContextTest, TimerServiceDoesNotSpawnThreadsBeforeStart) { +TEST_F(AsioTransportLayerWithServiceContextTest, TimerServiceDoesNotSpawnThreadsBeforeStart) { ThreadCounter counter; - { transport::TransportLayerASIO::TimerService service{{counter.makeSpawnFunc()}}; } + { transport::AsioTransportLayer::TimerService service{{counter.makeSpawnFunc()}}; } ASSERT_EQ(counter.created(), 0); } -TEST_F(TransportLayerASIOWithServiceContextTest, TimerServiceOneShotStart) { +TEST_F(AsioTransportLayerWithServiceContextTest, TimerServiceOneShotStart) { ThreadCounter counter; - transport::TransportLayerASIO::TimerService service{{counter.makeSpawnFunc()}}; + transport::AsioTransportLayer::TimerService service{{counter.makeSpawnFunc()}}; service.start(); LOGV2(5490004, "Awaiting timer thread start", "threads"_attr = counter.started()); counter.waitForStarted([](auto n) { return n > 0; }); @@ -773,30 +773,30 @@ TEST_F(TransportLayerASIOWithServiceContextTest, TimerServiceOneShotStart) { ASSERT_EQ(counter.created(), 1) << "Redundant start should spawn only once"; } -TEST_F(TransportLayerASIOWithServiceContextTest, TimerServiceDoesNotStartAfterStop) { +TEST_F(AsioTransportLayerWithServiceContextTest, TimerServiceDoesNotStartAfterStop) { ThreadCounter counter; - transport::TransportLayerASIO::TimerService service{{counter.makeSpawnFunc()}}; + transport::AsioTransportLayer::TimerService service{{counter.makeSpawnFunc()}}; service.stop(); service.start(); ASSERT_EQ(counter.created(), 0) << "Stop then start should not spawn"; } -TEST_F(TransportLayerASIOWithServiceContextTest, TimerServiceCanStopMoreThanOnce) { +TEST_F(AsioTransportLayerWithServiceContextTest, TimerServiceCanStopMoreThanOnce) { // Verifying that it is safe to have multiple calls to `stop()`. { - transport::TransportLayerASIO::TimerService service; + transport::AsioTransportLayer::TimerService service; service.start(); service.stop(); service.stop(); } { - transport::TransportLayerASIO::TimerService service; + transport::AsioTransportLayer::TimerService service; service.stop(); service.stop(); } } -TEST_F(TransportLayerASIOWithServiceContextTest, TransportStartAfterShutDown) { +TEST_F(AsioTransportLayerWithServiceContextTest, TransportStartAfterShutDown) { tla().shutdown(); ASSERT_EQ(tla().start(), transport::TransportLayer::ShutdownStatus); } @@ -804,7 +804,7 @@ TEST_F(TransportLayerASIOWithServiceContextTest, TransportStartAfterShutDown) { #ifdef MONGO_CONFIG_SSL #ifndef _WIN32 // TODO SERVER-62035: enable the following on Windows. -TEST_F(TransportLayerASIOWithServiceContextTest, ShutdownDuringSSLHandshake) { +TEST_F(AsioTransportLayerWithServiceContextTest, ShutdownDuringSSLHandshake) { /** * Creates a server and a client thread: * - The server listens for incoming connections, but doesn't participate in SSL handshake. @@ -1156,7 +1156,7 @@ TEST_F(BatonASIOLinuxTest, CancelAsyncOperationsInterruptsOngoingOperations) { // Blocks the main thread as it schedules an opportunistic read, but before it starts // polling on the networking baton. Then it cancels the operation before unblocking the main // thread. - FailPointEnableBlock fp("transportLayerASIOBlockBeforeOpportunisticRead"); + FailPointEnableBlock fp("asioTransportLayerBlockBeforeOpportunisticRead"); isReady.set(); waitForTimesEntered(fp, 1); client().session()->cancelAsyncOperations(); @@ -1182,7 +1182,7 @@ TEST_F(BatonASIOLinuxTest, AsyncOpsMakeProgressWhenSessionAddedToDetachedBaton) }); }); - FailPointEnableBlock fp("transportLayerASIOBlockBeforeAddSession"); + FailPointEnableBlock fp("asioTransportLayerBlockBeforeAddSession"); ready.set(); waitForTimesEntered(fp, 1); diff --git a/src/mongo/transport/baton_asio_linux.cpp b/src/mongo/transport/baton_asio_linux.cpp index 92120858ef9..63df00562f1 100644 --- a/src/mongo/transport/baton_asio_linux.cpp +++ b/src/mongo/transport/baton_asio_linux.cpp @@ -140,7 +140,7 @@ public: } // namespace -void TransportLayerASIO::BatonASIO::schedule(Task func) noexcept { +void AsioTransportLayer::BatonASIO::schedule(Task func) noexcept { auto task = [this, func = std::move(func)](stdx::unique_lock<Mutex> lk) mutable { auto status = _opCtx ? Status::OK() : getDetachedError(); lk.unlock(); @@ -159,11 +159,11 @@ void TransportLayerASIO::BatonASIO::schedule(Task func) noexcept { notify(); } -void TransportLayerASIO::BatonASIO::notify() noexcept { +void AsioTransportLayer::BatonASIO::notify() noexcept { efd(_opCtx).notify(); } -Waitable::TimeoutState TransportLayerASIO::BatonASIO::run_until(ClockSource* clkSource, +Waitable::TimeoutState AsioTransportLayer::BatonASIO::run_until(ClockSource* clkSource, Date_t deadline) noexcept { // Set up a timer on the baton with the specified deadline. This synthetic timer is used by // `_poll()`, which is called through `run()`, to enforce a deadline for the blocking `::poll`. @@ -182,7 +182,7 @@ Waitable::TimeoutState TransportLayerASIO::BatonASIO::run_until(ClockSource* clk } } -void TransportLayerASIO::BatonASIO::run(ClockSource* clkSource) noexcept { +void AsioTransportLayer::BatonASIO::run(ClockSource* clkSource) noexcept { // On the way out, fulfill promises and run scheduled jobs without holding the lock. std::list<Promise<void>> toFulfill; const ScopeGuard guard([&] { @@ -218,7 +218,7 @@ void TransportLayerASIO::BatonASIO::run(ClockSource* clkSource) noexcept { } } -void TransportLayerASIO::BatonASIO::markKillOnClientDisconnect() noexcept { +void AsioTransportLayer::BatonASIO::markKillOnClientDisconnect() noexcept { auto client = _opCtx->getClient(); invariant(client); if (auto session = client->session()) { @@ -229,11 +229,11 @@ void TransportLayerASIO::BatonASIO::markKillOnClientDisconnect() noexcept { } } -Future<void> TransportLayerASIO::BatonASIO::addSession(Session& session, Type type) noexcept { +Future<void> AsioTransportLayer::BatonASIO::addSession(Session& session, Type type) noexcept { return _addSession(session, type == Type::In ? POLLIN : POLLOUT); } -Future<void> TransportLayerASIO::BatonASIO::waitUntil(const ReactorTimer& reactorTimer, +Future<void> AsioTransportLayer::BatonASIO::waitUntil(const ReactorTimer& reactorTimer, Date_t expiration) noexcept try { auto pf = makePromiseFuture<void>(); _safeExecute(stdx::unique_lock(_mutex), @@ -247,7 +247,7 @@ Future<void> TransportLayerASIO::BatonASIO::waitUntil(const ReactorTimer& reacto return ex.toStatus(); } -bool TransportLayerASIO::BatonASIO::cancelSession(Session& session) noexcept { +bool AsioTransportLayer::BatonASIO::cancelSession(Session& session) noexcept { const auto id = session.id(); stdx::unique_lock lk(_mutex); @@ -269,7 +269,7 @@ bool TransportLayerASIO::BatonASIO::cancelSession(Session& session) noexcept { return true; } -bool TransportLayerASIO::BatonASIO::cancelTimer(const ReactorTimer& timer) noexcept { +bool AsioTransportLayer::BatonASIO::cancelTimer(const ReactorTimer& timer) noexcept { const auto id = timer.id(); stdx::unique_lock lk(_mutex); @@ -292,13 +292,13 @@ bool TransportLayerASIO::BatonASIO::cancelTimer(const ReactorTimer& timer) noexc return true; } -bool TransportLayerASIO::BatonASIO::canWait() noexcept { +bool AsioTransportLayer::BatonASIO::canWait() noexcept { stdx::lock_guard lk(_mutex); return _opCtx; } -void TransportLayerASIO::BatonASIO::_safeExecute(stdx::unique_lock<Mutex> lk, - TransportLayerASIO::BatonASIO::Job job) { +void AsioTransportLayer::BatonASIO::_safeExecute(stdx::unique_lock<Mutex> lk, + AsioTransportLayer::BatonASIO::Job job) { if (!_opCtx) { // If we're detached, no job can safely execute. iasserted(getDetachedError()); @@ -312,7 +312,7 @@ void TransportLayerASIO::BatonASIO::_safeExecute(stdx::unique_lock<Mutex> lk, } } -std::list<Promise<void>> TransportLayerASIO::BatonASIO::_poll(stdx::unique_lock<Mutex>& lk, +std::list<Promise<void>> AsioTransportLayer::BatonASIO::_poll(stdx::unique_lock<Mutex>& lk, ClockSource* clkSource) { const auto now = clkSource->now(); @@ -389,7 +389,7 @@ std::list<Promise<void>> TransportLayerASIO::BatonASIO::_poll(stdx::unique_lock< return promises; } -Future<void> TransportLayerASIO::BatonASIO::_addSession(Session& session, short events) try { +Future<void> AsioTransportLayer::BatonASIO::_addSession(Session& session, short events) try { auto pf = makePromiseFuture<void>(); TransportSession ts{checked_cast<AsioSession&>(session).getSocket().native_handle(), events, @@ -404,7 +404,7 @@ Future<void> TransportLayerASIO::BatonASIO::_addSession(Session& session, short return ex.toStatus(); } -void TransportLayerASIO::BatonASIO::detachImpl() noexcept { +void AsioTransportLayer::BatonASIO::detachImpl() noexcept { decltype(_scheduled) scheduled; decltype(_sessions) sessions; decltype(_timers) timers; diff --git a/src/mongo/transport/baton_asio_linux.h b/src/mongo/transport/baton_asio_linux.h index c444b46e345..d270371b7fd 100644 --- a/src/mongo/transport/baton_asio_linux.h +++ b/src/mongo/transport/baton_asio_linux.h @@ -49,11 +49,11 @@ namespace mongo { namespace transport { /** - * TransportLayerASIO Baton implementation for linux. + * AsioTransportLayer Baton implementation for linux. * * We implement our networking reactor on top of poll + eventfd for wakeups */ -class TransportLayerASIO::BatonASIO : public NetworkingBaton { +class AsioTransportLayer::BatonASIO : public NetworkingBaton { public: BatonASIO(OperationContext* opCtx) : _opCtx(opCtx) {} diff --git a/src/mongo/transport/service_executor_test.cpp b/src/mongo/transport/service_executor_test.cpp index 70605762783..c8a7ae3444c 100644 --- a/src/mongo/transport/service_executor_test.cpp +++ b/src/mongo/transport/service_executor_test.cpp @@ -196,7 +196,7 @@ public: /* This implements the portions of the transport::Reactor based on ASIO, but leaves out * the methods not needed by ServiceExecutors. * - * TODO Maybe use TransportLayerASIO's Reactor? + * TODO Maybe use AsioTransportLayer's Reactor? */ class ASIOReactor : public transport::Reactor { public: diff --git a/src/mongo/transport/transport_layer_egress_init.cpp b/src/mongo/transport/transport_layer_egress_init.cpp index 4c201829c7c..c00a2f9a105 100644 --- a/src/mongo/transport/transport_layer_egress_init.cpp +++ b/src/mongo/transport/transport_layer_egress_init.cpp @@ -31,7 +31,7 @@ #include "mongo/base/init.h" #include "mongo/db/service_context.h" -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #include <iostream> @@ -43,9 +43,9 @@ namespace { ServiceContext::ConstructorActionRegisterer registerEgressTransportLayer{ "ConfigureEgressTransportLayer", [](ServiceContext* sc) { invariant(!sc->getTransportLayer()); - transport::TransportLayerASIO::Options opts; - opts.mode = transport::TransportLayerASIO::Options::kEgress; - sc->setTransportLayer(std::make_unique<transport::TransportLayerASIO>(opts, nullptr)); + transport::AsioTransportLayer::Options opts; + opts.mode = transport::AsioTransportLayer::Options::kEgress; + sc->setTransportLayer(std::make_unique<transport::AsioTransportLayer>(opts, nullptr)); uassertStatusOK(sc->getTransportLayer()->setup()); uassertStatusOK(sc->getTransportLayer()->start()); }}; diff --git a/src/mongo/transport/transport_layer_manager.cpp b/src/mongo/transport/transport_layer_manager.cpp index 32702186ea0..44b0c815e1b 100644 --- a/src/mongo/transport/transport_layer_manager.cpp +++ b/src/mongo/transport/transport_layer_manager.cpp @@ -41,9 +41,9 @@ #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" #include "mongo/logv2/log.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/service_executor_synchronous.h" #include "mongo/transport/session.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/util/net/ssl_types.h" #include "mongo/util/time_support.h" @@ -135,11 +135,11 @@ Status TransportLayerManager::addAndStartTransportLayer(std::unique_ptr<Transpor } std::unique_ptr<TransportLayer> TransportLayerManager::makeAndStartDefaultEgressTransportLayer() { - transport::TransportLayerASIO::Options opts(&serverGlobalParams); - opts.mode = transport::TransportLayerASIO::Options::kEgress; + transport::AsioTransportLayer::Options opts(&serverGlobalParams); + opts.mode = transport::AsioTransportLayer::Options::kEgress; opts.ipList.clear(); - auto ret = std::make_unique<transport::TransportLayerASIO>(opts, nullptr); + auto ret = std::make_unique<transport::AsioTransportLayer>(opts, nullptr); uassertStatusOK(ret->setup()); uassertStatusOK(ret->start()); return std::unique_ptr<TransportLayer>(std::move(ret)); @@ -149,9 +149,9 @@ std::unique_ptr<TransportLayer> TransportLayerManager::createWithConfig( const ServerGlobalParams* config, ServiceContext* ctx, boost::optional<int> loadBalancerPort) { auto sep = ctx->getServiceEntryPoint(); - transport::TransportLayerASIO::Options opts(config, loadBalancerPort); + transport::AsioTransportLayer::Options opts(config, loadBalancerPort); std::vector<std::unique_ptr<TransportLayer>> retVector; - retVector.emplace_back(std::make_unique<transport::TransportLayerASIO>(opts, sep)); + retVector.emplace_back(std::make_unique<transport::AsioTransportLayer>(opts, sep)); return std::make_unique<TransportLayerManager>(std::move(retVector)); } diff --git a/src/mongo/unittest/integration_test_main.cpp b/src/mongo/unittest/integration_test_main.cpp index 8dd2949fc6f..b96a48e5d8e 100644 --- a/src/mongo/unittest/integration_test_main.cpp +++ b/src/mongo/unittest/integration_test_main.cpp @@ -44,7 +44,7 @@ #include "mongo/db/service_context.h" #include "mongo/db/wire_version.h" #include "mongo/logv2/log.h" -#include "mongo/transport/transport_layer_asio.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/unittest/unittest.h" #include "mongo/util/exit_code.h" #include "mongo/util/options_parser/environment.h" diff --git a/src/mongo/util/net/README.md b/src/mongo/util/net/README.md index d77d8a91593..fbc7daebb9b 100644 --- a/src/mongo/util/net/README.md +++ b/src/mongo/util/net/README.md @@ -114,7 +114,7 @@ access rights. The _transport layer_ calls appropriate TLS functions inside of its own related functions. [`TransportLayerManager::connect`](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/transport_layer_manager.h#L66) will make a call to -[`AsioSession::handshakeSSLForEgress`](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/transport_layer_asio.cpp#L496) +[`AsioSession::handshakeSSLForEgress`](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/asio_transport_layer.cpp#L496) when it needs to speak TLS. This works the same for [`asyncConnect`](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/transport_layer.h#L85) as well. [`TransportLayerManager`](../../transport/transport_layer_manager.h) provides these and diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp index df1022648e5..7d2aa049d50 100644 --- a/src/mongo/util/net/ssl_manager.cpp +++ b/src/mongo/util/net/ssl_manager.cpp @@ -45,8 +45,8 @@ #include "mongo/db/commands/server_status.h" #include "mongo/logv2/log.h" #include "mongo/platform/overflow_arithmetic.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/session.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/util/ctype.h" #include "mongo/util/hex.h" #include "mongo/util/icu.h" diff --git a/src/mongo/util/net/ssl_manager_test.cpp b/src/mongo/util/net/ssl_manager_test.cpp index c44fbfd4d2a..45e9216ea79 100644 --- a/src/mongo/util/net/ssl_manager_test.cpp +++ b/src/mongo/util/net/ssl_manager_test.cpp @@ -33,8 +33,8 @@ #include "mongo/config.h" #include "mongo/platform/basic.h" +#include "mongo/transport/asio_transport_layer.h" #include "mongo/transport/service_entry_point.h" -#include "mongo/transport/transport_layer_asio.h" #include "mongo/transport/transport_layer_manager.h" #include "mongo/util/net/ssl/context.hpp" #include "mongo/util/net/ssl_manager.h" @@ -507,10 +507,10 @@ TEST(SSLManager, RotateCertificatesFromFile) { auto options = [] { ServerGlobalParams params; params.noUnixSocket = true; - transport::TransportLayerASIO::Options opts(¶ms); + transport::AsioTransportLayer::Options opts(¶ms); return opts; }(); - transport::TransportLayerASIO tla(options, &sepu); + transport::AsioTransportLayer tla(options, &sepu); uassertStatusOK(tla.rotateCertificates(manager, false /* asyncOCSPStaple */)); } @@ -543,10 +543,10 @@ TEST(SSLManager, RotateClusterCertificatesFromFile) { auto options = [] { ServerGlobalParams params; params.noUnixSocket = true; - transport::TransportLayerASIO::Options opts(¶ms); + transport::AsioTransportLayer::Options opts(¶ms); return opts; }(); - transport::TransportLayerASIO tla(options, &sepu); + transport::AsioTransportLayer tla(options, &sepu); uassertStatusOK(tla.rotateCertificates(manager, false /* asyncOCSPStaple */)); } @@ -611,10 +611,10 @@ TEST(SSLManager, TransientSSLParams) { auto options = [] { ServerGlobalParams params; params.noUnixSocket = true; - transport::TransportLayerASIO::Options opts(¶ms); + transport::AsioTransportLayer::Options opts(¶ms); return opts; }(); - transport::TransportLayerASIO tla(options, &sepu); + transport::AsioTransportLayer tla(options, &sepu); TransientSSLParams transientSSLParams; transientSSLParams.sslClusterPEMPayload = loadFile("jstests/libs/client.pem"); @@ -644,10 +644,10 @@ TEST(SSLManager, TransientSSLParamsStressTestWithTransport) { auto options = [] { ServerGlobalParams params; params.noUnixSocket = true; - transport::TransportLayerASIO::Options opts(¶ms); + transport::AsioTransportLayer::Options opts(¶ms); return opts; }(); - transport::TransportLayerASIO tla(options, &sepu); + transport::AsioTransportLayer tla(options, &sepu); TransientSSLParams transientSSLParams; transientSSLParams.sslClusterPEMPayload = loadFile("jstests/libs/client.pem"); |