diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
| commit | 294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch) | |
| tree | 279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/executor/network_interface_tl.h | |
| parent | 70be7c27a251621187a1de533462ae2bb1e3bd39 (diff) | |
| parent | 1e917fd798aa25b7066d4b414b51184f13d5a092 (diff) | |
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10'
with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/executor/network_interface_tl.h')
| -rw-r--r-- | src/mongo/executor/network_interface_tl.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h index 158e4b0a679..68c51d57aa7 100644 --- a/src/mongo/executor/network_interface_tl.h +++ b/src/mongo/executor/network_interface_tl.h @@ -31,9 +31,12 @@ #include <deque> +#include <boost/optional.hpp> + #include "mongo/client/async_client.h" #include "mongo/db/service_context.h" #include "mongo/executor/connection_pool.h" +#include "mongo/executor/connection_pool_tl.h" #include "mongo/executor/network_interface.h" #include "mongo/logv2/log_severity.h" #include "mongo/platform/mutex.h" @@ -103,6 +106,33 @@ public: Milliseconds timeout, Status status) override; + /** + * NetworkInterfaceTL's implementation of a leased network-stream + * provided for manual use outside of the NITL's usual RPC API. + * When this type is destroyed, the destructor of the ConnectionHandle + * member will return the connection to this NetworkInterface's ConnectionPool. + */ + class LeasedStream : public NetworkInterface::LeasedStream { + public: + AsyncDBClient* getClient() override; + + LeasedStream(ConnectionPool::ConnectionHandle&& conn) : _conn{std::move(conn)} {} + + // These pass-through indications of the health of the leased + // stream to the underlying ConnectionHandle + void indicateSuccess() override; + void indicateUsed() override; + void indicateFailure(Status) override; + + private: + ConnectionPool::ConnectionHandle _conn; + }; + + SemiFuture<std::unique_ptr<NetworkInterface::LeasedStream>> leaseStream( + const HostAndPort& hostAndPort, + transport::ConnectSSLMode sslMode, + Milliseconds timeout) override; + private: struct RequestState; struct RequestManager; @@ -342,8 +372,10 @@ private: std::unique_ptr<transport::TransportLayer> _ownedTransportLayer; transport::ReactorHandle _reactor; - mutable Mutex _mutex = - MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(3), "NetworkInterfaceTL::_mutex"); + // TODO SERVER-75830: This Mutex used to be at hierarcichal acquisition level 3. We temporary + // removed the level because it is sometimes acquired as part of task-scheduling when + // lower-level mutexes (like the ConnectionPool's) are held. + mutable Mutex _mutex = MONGO_MAKE_LATCH("NetworkInterfaceTL::_mutex"); const ConnectionPool::Options _connPoolOpts; std::unique_ptr<NetworkConnectionHook> _onConnectHook; std::shared_ptr<ConnectionPool> _pool; |
