Skip to content

Commit 318ab93

Browse files
authored
upstream: Expose the drainConnections method on the connection pool. (#22554)
Exposing the drainConnections method on the connection pool, so that Nighthawk can correctly drain the connection pools used by its individual workers. Fixes #22527. Works on envoyproxy/nighthawk#873. /cc @alyssawilk Risk Level: low, existing functionality isn't affected. Testing: unit tests. Docs Changes: n/a. Release Notes: n/a. Platform Specific Features: n/a. Signed-off-by: Jakub Sobon <[email protected]>
1 parent a00c314 commit 318ab93

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

envoy/upstream/thread_local_cluster.h

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class HttpPoolData {
3333
* See documentation of Envoy::ConnectionPool::Instance.
3434
*/
3535
void addIdleCallback(ConnectionPool::Instance::IdleCb cb) { pool_->addIdleCallback(cb); };
36+
void drainConnections(ConnectionPool::DrainBehavior drain_behavior) {
37+
pool_->drainConnections(drain_behavior);
38+
};
3639

3740
Upstream::HostDescriptionConstSharedPtr host() const { return pool_->host(); }
3841

test/common/upstream/cluster_manager_impl_test.cc

+3
Original file line numberDiff line numberDiff line change
@@ -4248,6 +4248,9 @@ TEST_F(ClusterManagerImplTest, HttpPoolDataForwardsCallsToConnectionPool) {
42484248
ConnectionPool::Instance::IdleCb drained_cb = []() {};
42494249
EXPECT_CALL(*pool_mock, addIdleCallback(_));
42504250
opt_cp.value().addIdleCallback(drained_cb);
4251+
4252+
EXPECT_CALL(*pool_mock, drainConnections(ConnectionPool::DrainBehavior::DrainAndDelete));
4253+
opt_cp.value().drainConnections(ConnectionPool::DrainBehavior::DrainAndDelete);
42514254
}
42524255

42534256
// Test that the read only cross-priority host map in the main thread is correctly synchronized to

0 commit comments

Comments
 (0)