diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.cc b/test/cpp/end2end/xds/xds_end2end_test_lib.cc index e91e4af4511..b95d91a1dd9 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.cc +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.cc @@ -171,6 +171,16 @@ void XdsEnd2endTest::ServerThread::StopListeningAndSendGoaways() { gpr_log(GPR_INFO, "%s done sending GOAWAYs", Type()); } +void XdsEnd2endTest::ServerThread::StopListening() { + gpr_log(GPR_INFO, "%s about to stop listening", Type()); + { + grpc_core::ExecCtx exec_ctx; + auto* server = grpc_core::Server::FromC(server_->c_server()); + server->StopListening(); + } + gpr_log(GPR_INFO, "%s stopped listening", Type()); +} + void XdsEnd2endTest::ServerThread::Serve(grpc_core::Mutex* mu, grpc_core::CondVar* cond) { // We need to acquire the lock here in order to prevent the notify_one diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.h b/test/cpp/end2end/xds/xds_end2end_test_lib.h index cdb98d90591..1b9ade11905 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.h +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.h @@ -259,6 +259,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam, allow_put_requests_ = allow_put_requests; } + void StopListening(); + void StopListeningAndSendGoaways(); private: