summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-03-23 10:23:58 -0400
committersamantharitter <samantha.ritter@10gen.com>2017-03-28 13:37:01 -0400
commit7cb8e593603c844906852871b114639c85b4a279 (patch)
tree47f44e6836c0ec1c2bc0c7eb6cceab07972c56bb /src/mongo
parent8874782785aa177e71fbf86ace6bd533705e7ad7 (diff)
downloadmongo-7cb8e593603c844906852871b114639c85b4a279.tar.gz
SERVER-28430 Expose dropConnections() method on ConnectionPool through the NetworkInterface
(cherry-picked from commit 5014eade5aa8c6ce258bbe785d2c3c8c1d0e2198)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/executor/network_interface.h5
-rw-r--r--src/mongo/executor/network_interface_asio.cpp4
-rw-r--r--src/mongo/executor/network_interface_asio.h2
-rw-r--r--src/mongo/executor/network_interface_mock.h2
-rw-r--r--src/mongo/executor/thread_pool_task_executor.cpp4
-rw-r--r--src/mongo/executor/thread_pool_task_executor.h5
6 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/executor/network_interface.h b/src/mongo/executor/network_interface.h
index 3b73761ef10..1c5f748d593 100644
--- a/src/mongo/executor/network_interface.h
+++ b/src/mongo/executor/network_interface.h
@@ -166,6 +166,11 @@ public:
*/
virtual bool onNetworkThread() = 0;
+ /**
+ * Drops all connections to the given host in the connection pool.
+ */
+ virtual void dropConnections(const HostAndPort& hostAndPort) = 0;
+
protected:
NetworkInterface();
};
diff --git a/src/mongo/executor/network_interface_asio.cpp b/src/mongo/executor/network_interface_asio.cpp
index 6b3ad4fc687..8acfa3885ed 100644
--- a/src/mongo/executor/network_interface_asio.cpp
+++ b/src/mongo/executor/network_interface_asio.cpp
@@ -530,5 +530,9 @@ void NetworkInterfaceASIO::_failWithInfo_inlock(const char* file,
fassertFailedWithStatus(34429, status);
}
+void NetworkInterfaceASIO::dropConnections(const HostAndPort& hostAndPort) {
+ _connectionPool.dropConnections(hostAndPort);
+}
+
} // namespace executor
} // namespace mongo
diff --git a/src/mongo/executor/network_interface_asio.h b/src/mongo/executor/network_interface_asio.h
index 59547b4db60..bf35ed452d2 100644
--- a/src/mongo/executor/network_interface_asio.h
+++ b/src/mongo/executor/network_interface_asio.h
@@ -137,6 +137,8 @@ public:
bool onNetworkThread() override;
+ void dropConnections(const HostAndPort& hostAndPort) override;
+
private:
using ResponseStatus = TaskExecutor::ResponseStatus;
using NetworkInterface::RemoteCommandCompletionFn;
diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h
index 6a34ceb45b3..09315e11e16 100644
--- a/src/mongo/executor/network_interface_mock.h
+++ b/src/mongo/executor/network_interface_mock.h
@@ -126,6 +126,8 @@ public:
virtual bool onNetworkThread();
+ void dropConnections(const HostAndPort&) override {}
+
////////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mongo/executor/thread_pool_task_executor.cpp b/src/mongo/executor/thread_pool_task_executor.cpp
index f1f990df41b..18d98a427d6 100644
--- a/src/mongo/executor/thread_pool_task_executor.cpp
+++ b/src/mongo/executor/thread_pool_task_executor.cpp
@@ -522,5 +522,9 @@ void ThreadPoolTaskExecutor::runCallback(std::shared_ptr<CallbackState> cbStateA
}
}
+void ThreadPoolTaskExecutor::dropConnections(const HostAndPort& hostAndPort) {
+ _net->dropConnections(hostAndPort);
+}
+
} // namespace executor
} // namespace mongo
diff --git a/src/mongo/executor/thread_pool_task_executor.h b/src/mongo/executor/thread_pool_task_executor.h
index 3f573e1ab9d..17af3f4dff3 100644
--- a/src/mongo/executor/thread_pool_task_executor.h
+++ b/src/mongo/executor/thread_pool_task_executor.h
@@ -88,6 +88,11 @@ public:
*/
void cancelAllCommands();
+ /**
+ * Drops all connections to the given host on the network interface.
+ */
+ void dropConnections(const HostAndPort& hostAndPort);
+
private:
class CallbackState;
class EventState;