diff options
author | Alex Li <alex.li@mongodb.com> | 2021-08-12 12:43:38 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-12 13:16:12 +0000 |
commit | 83b85e16eda33753e8b4a277591d6b2081a3b514 (patch) | |
tree | 01a60b3e30859adcf313f8ad480a9e0bd7d149ff /src | |
parent | 41d1ddba874968ba0268ba16adaf1823d027b5a2 (diff) | |
download | mongo-83b85e16eda33753e8b4a277591d6b2081a3b514.tar.gz |
SERVER-51695 Use NetworkInterfaceTL name as application name
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/executor/connection_pool.cpp | 3 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool.h | 6 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_test_fixture.cpp | 2 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_test_fixture.h | 2 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_tl.cpp | 7 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_tl.h | 2 | ||||
-rw-r--r-- | src/mongo/util/net/http_client_curl.cpp | 4 |
7 files changed, 16 insertions, 10 deletions
diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp index 96a8410fd9e..1fa7790a300 100644 --- a/src/mongo/executor/connection_pool.cpp +++ b/src/mongo/executor/connection_pool.cpp @@ -1060,7 +1060,8 @@ void ConnectionPool::SpecificPool::spawnConnections() { handle->setup(_parent->_controller->pendingTimeout(), guardCallback([this](auto conn, auto status) { finishRefresh(std::move(conn), std::move(status)); - })); + }), + _parent->getName()); } } diff --git a/src/mongo/executor/connection_pool.h b/src/mongo/executor/connection_pool.h index 86fa370bd9a..0e5bf90dc9a 100644 --- a/src/mongo/executor/connection_pool.h +++ b/src/mongo/executor/connection_pool.h @@ -263,6 +263,10 @@ public: size_t getNumConnectionsPerHost(const HostAndPort& hostAndPort) const; + std::string getName() const { + return _name; + } + private: std::string _name; @@ -409,7 +413,7 @@ protected: * Sets up the connection. This should include connection + auth + any * other associated hooks. */ - virtual void setup(Milliseconds timeout, SetupCallback cb) = 0; + virtual void setup(Milliseconds timeout, SetupCallback cb, std::string instanceName) = 0; /** * Resets the connection's state to kConnectionStateUnknown for the next user. diff --git a/src/mongo/executor/connection_pool_test_fixture.cpp b/src/mongo/executor/connection_pool_test_fixture.cpp index 5cbfdf8d1d5..09f2e6b958a 100644 --- a/src/mongo/executor/connection_pool_test_fixture.cpp +++ b/src/mongo/executor/connection_pool_test_fixture.cpp @@ -181,7 +181,7 @@ void ConnectionImpl::cancelTimeout() { _timer.cancelTimeout(); } -void ConnectionImpl::setup(Milliseconds timeout, SetupCallback cb) { +void ConnectionImpl::setup(Milliseconds timeout, SetupCallback cb, std::string) { _setupCallback = std::move(cb); _timer.setTimeout(timeout, [this] { diff --git a/src/mongo/executor/connection_pool_test_fixture.h b/src/mongo/executor/connection_pool_test_fixture.h index 78d14c3e77d..fadb22044c8 100644 --- a/src/mongo/executor/connection_pool_test_fixture.h +++ b/src/mongo/executor/connection_pool_test_fixture.h @@ -113,7 +113,7 @@ public: Date_t now() override; private: - void setup(Milliseconds timeout, SetupCallback cb) override; + void setup(Milliseconds timeout, SetupCallback cb, std::string) override; void refresh(Milliseconds timeout, RefreshCallback cb) override; diff --git a/src/mongo/executor/connection_pool_tl.cpp b/src/mongo/executor/connection_pool_tl.cpp index 8d2dc9f615c..30383538b1a 100644 --- a/src/mongo/executor/connection_pool_tl.cpp +++ b/src/mongo/executor/connection_pool_tl.cpp @@ -292,7 +292,7 @@ private: } // namespace -void TLConnection::setup(Milliseconds timeout, SetupCallback cb) { +void TLConnection::setup(Milliseconds timeout, SetupCallback cb, std::string instanceName) { auto anchor = shared_from_this(); auto pf = makePromiseFuture<void>(); @@ -333,9 +333,10 @@ void TLConnection::setup(Milliseconds timeout, SetupCallback cb) { .onError([](StatusWith<AsyncDBClient::Handle> swc) -> StatusWith<AsyncDBClient::Handle> { return Status(ErrorCodes::HostUnreachable, swc.getStatus().reason()); }) - .then([this, isMasterHook](AsyncDBClient::Handle client) { + .then([this, isMasterHook, instanceName = std::move(instanceName)]( + AsyncDBClient::Handle client) { _client = std::move(client); - return _client->initWireVersion("NetworkInterfaceTL", isMasterHook.get()); + return _client->initWireVersion(instanceName, isMasterHook.get()); }) .then([this, isMasterHook]() -> Future<bool> { if (_skipAuth) { diff --git a/src/mongo/executor/connection_pool_tl.h b/src/mongo/executor/connection_pool_tl.h index 5cdb3036fd7..f4498cdcda2 100644 --- a/src/mongo/executor/connection_pool_tl.h +++ b/src/mongo/executor/connection_pool_tl.h @@ -179,7 +179,7 @@ public: private: void setTimeout(Milliseconds timeout, TimeoutCallback cb) override; void cancelTimeout() override; - void setup(Milliseconds timeout, SetupCallback cb) override; + void setup(Milliseconds timeout, SetupCallback cb, std::string instanceName) override; void refresh(Milliseconds timeout, RefreshCallback cb) override; void cancelAsync(); diff --git a/src/mongo/util/net/http_client_curl.cpp b/src/mongo/util/net/http_client_curl.cpp index d8c2fc025c7..af91c074c1c 100644 --- a/src/mongo/util/net/http_client_curl.cpp +++ b/src/mongo/util/net/http_client_curl.cpp @@ -419,7 +419,7 @@ public: } private: - void setup(Milliseconds timeout, SetupCallback cb) final; + void setup(Milliseconds timeout, SetupCallback cb, std::string) final; void refresh(Milliseconds timeout, RefreshCallback cb) final; @@ -433,7 +433,7 @@ private: CurlEasyHandle _handle; }; -void PooledCurlHandle::setup(Milliseconds timeout, SetupCallback cb) { +void PooledCurlHandle::setup(Milliseconds timeout, SetupCallback cb, std::string) { auto anchor = shared_from_this(); _executor->schedule([this, anchor, cb = std::move(cb)](auto execStatus) { if (!execStatus.isOK()) { |