diff --git a/grpc.def b/grpc.def index 0cc981d0fd5..41ad2dd61df 100644 --- a/grpc.def +++ b/grpc.def @@ -41,7 +41,6 @@ EXPORTS grpc_completion_queue_thread_local_cache_init grpc_completion_queue_thread_local_cache_flush grpc_channel_check_connectivity_state - grpc_channel_num_external_connectivity_watchers grpc_channel_watch_connectivity_state grpc_channel_support_connectivity_watcher grpc_channel_create_call diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index d03f8a7df0c..ad475897b17 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -177,12 +177,6 @@ GRPCAPI int grpc_completion_queue_thread_local_cache_flush( GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( grpc_channel* channel, int try_to_connect); -/** Number of active "external connectivity state watchers" attached to a - * channel. - * Useful for testing. **/ -GRPCAPI int grpc_channel_num_external_connectivity_watchers( - grpc_channel* channel); - /** Watch for a change in connectivity state. Once the channel connectivity state is different from last_observed_state, tag will be enqueued on cq with success=1. diff --git a/src/core/client_channel/channel_connectivity.cc b/src/core/client_channel/channel_connectivity.cc index 52fc35a9ba0..5ae94d612a5 100644 --- a/src/core/client_channel/channel_connectivity.cc +++ b/src/core/client_channel/channel_connectivity.cc @@ -81,21 +81,6 @@ grpc_connectivity_state grpc_channel_check_connectivity_state( return client_channel->CheckConnectivityState(try_to_connect); } -int grpc_channel_num_external_connectivity_watchers(grpc_channel* c_channel) { - grpc_core::Channel* channel = grpc_core::Channel::FromC(c_channel); - grpc_core::ClientChannelFilter* client_channel = - grpc_core::ClientChannelFilter::GetFromChannel(channel); - if (client_channel == nullptr) { - if (!grpc_core::IsLameChannel(channel)) { - gpr_log(GPR_ERROR, - "grpc_channel_num_external_connectivity_watchers called on " - "something that is not a client channel"); - } - return 0; - } - return client_channel->NumExternalConnectivityWatchers(); -} - int grpc_channel_support_connectivity_watcher(grpc_channel* channel) { return grpc_core::ClientChannelFilter::GetFromChannel( grpc_core::Channel::FromC(channel)) != nullptr; diff --git a/src/core/client_channel/client_channel_filter.h b/src/core/client_channel/client_channel_filter.h index e27178b4a67..c904c8f23e2 100644 --- a/src/core/client_channel/client_channel_filter.h +++ b/src/core/client_channel/client_channel_filter.h @@ -149,11 +149,6 @@ class ClientChannelFilter { this, on_complete, /*cancel=*/true); } - int NumExternalConnectivityWatchers() const { - MutexLock lock(&external_watchers_mu_); - return static_cast(external_watchers_.size()); - } - // Starts and stops a connectivity watch. The watcher will be initially // notified as soon as the state changes from initial_state and then on // every subsequent state change until either the watch is stopped or diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index b28175e0165..302dbf49f44 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -64,7 +64,6 @@ grpc_completion_queue_destroy_type grpc_completion_queue_destroy_import; grpc_completion_queue_thread_local_cache_init_type grpc_completion_queue_thread_local_cache_init_import; grpc_completion_queue_thread_local_cache_flush_type grpc_completion_queue_thread_local_cache_flush_import; grpc_channel_check_connectivity_state_type grpc_channel_check_connectivity_state_import; -grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_external_connectivity_watchers_import; grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import; grpc_channel_support_connectivity_watcher_type grpc_channel_support_connectivity_watcher_import; grpc_channel_create_call_type grpc_channel_create_call_import; @@ -355,7 +354,6 @@ void grpc_rb_load_imports(HMODULE library) { grpc_completion_queue_thread_local_cache_init_import = (grpc_completion_queue_thread_local_cache_init_type) GetProcAddress(library, "grpc_completion_queue_thread_local_cache_init"); grpc_completion_queue_thread_local_cache_flush_import = (grpc_completion_queue_thread_local_cache_flush_type) GetProcAddress(library, "grpc_completion_queue_thread_local_cache_flush"); grpc_channel_check_connectivity_state_import = (grpc_channel_check_connectivity_state_type) GetProcAddress(library, "grpc_channel_check_connectivity_state"); - grpc_channel_num_external_connectivity_watchers_import = (grpc_channel_num_external_connectivity_watchers_type) GetProcAddress(library, "grpc_channel_num_external_connectivity_watchers"); grpc_channel_watch_connectivity_state_import = (grpc_channel_watch_connectivity_state_type) GetProcAddress(library, "grpc_channel_watch_connectivity_state"); grpc_channel_support_connectivity_watcher_import = (grpc_channel_support_connectivity_watcher_type) GetProcAddress(library, "grpc_channel_support_connectivity_watcher"); grpc_channel_create_call_import = (grpc_channel_create_call_type) GetProcAddress(library, "grpc_channel_create_call"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 65c095a96e4..d4e2099eda4 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -167,9 +167,6 @@ extern grpc_completion_queue_thread_local_cache_flush_type grpc_completion_queue typedef grpc_connectivity_state(*grpc_channel_check_connectivity_state_type)(grpc_channel* channel, int try_to_connect); extern grpc_channel_check_connectivity_state_type grpc_channel_check_connectivity_state_import; #define grpc_channel_check_connectivity_state grpc_channel_check_connectivity_state_import -typedef int(*grpc_channel_num_external_connectivity_watchers_type)(grpc_channel* channel); -extern grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_external_connectivity_watchers_import; -#define grpc_channel_num_external_connectivity_watchers grpc_channel_num_external_connectivity_watchers_import typedef void(*grpc_channel_watch_connectivity_state_type)(grpc_channel* channel, grpc_connectivity_state last_observed_state, gpr_timespec deadline, grpc_completion_queue* cq, void* tag); extern grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import; #define grpc_channel_watch_connectivity_state grpc_channel_watch_connectivity_state_import diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index abf0ac7cd22..2b1ee72dc94 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -93,8 +93,6 @@ void create_loop_destroy(void* addr) { grpc_timeout_milliseconds_to_deadline(POLL_MILLIS); ASSERT_EQ(grpc_completion_queue_next(cq, poll_time, nullptr).type, GRPC_OP_COMPLETE); - // check that the watcher from "watch state" was free'd - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(chan), 0); } grpc_channel_destroy(chan); grpc_completion_queue_destroy(cq); @@ -292,8 +290,6 @@ void watches_with_short_timeouts(void* addr) { grpc_event ev = grpc_completion_queue_next(cq, poll_time, nullptr); ASSERT_EQ(ev.type, GRPC_OP_COMPLETE); ASSERT_EQ(ev.success, false); - // check that the watcher from "watch state" was free'd - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(chan), 0); } grpc_channel_destroy(chan); grpc_completion_queue_destroy(cq); diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc index bf0178b6ffc..40ca9b67385 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.cc +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -55,8 +55,6 @@ static void channel_idle_start_watch(grpc_channel* channel, grpc_channel_watch_connectivity_state(channel, GRPC_CHANNEL_IDLE, connect_deadline, cq, reinterpret_cast(next_tag++)); - gpr_log(GPR_DEBUG, "number of active connect watchers: %d", - grpc_channel_num_external_connectivity_watchers(channel)); } static void channel_idle_poll_for_timeout(grpc_channel* channel, @@ -71,9 +69,8 @@ static void channel_idle_poll_for_timeout(grpc_channel* channel, GRPC_CHANNEL_IDLE); } -// Test and use the "num_external_watchers" call to make sure -// that "connectivity watcher" structs are free'd just after, if -// their corresponding timeouts occur. +// Test to make sure that "connectivity watcher" structs are free'd just +// after, if their corresponding timeouts occur. static void run_timeouts_test(const test_fixture* fixture) { gpr_log(GPR_INFO, "TEST: %s", fixture->name); @@ -87,7 +84,6 @@ static void run_timeouts_test(const test_fixture* fixture) { // start 1 watcher and then let it time out channel_idle_start_watch(channel, cq); channel_idle_poll_for_timeout(channel, cq); - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(channel), 0); // start 3 watchers and then let them all time out for (size_t i = 1; i <= 3; i++) { @@ -96,7 +92,6 @@ static void run_timeouts_test(const test_fixture* fixture) { for (size_t i = 1; i <= 3; i++) { channel_idle_poll_for_timeout(channel, cq); } - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(channel), 0); // start 3 watchers, see one time out, start another 3, and then see them all // time out @@ -110,7 +105,6 @@ static void run_timeouts_test(const test_fixture* fixture) { for (size_t i = 1; i <= 5; i++) { channel_idle_poll_for_timeout(channel, cq); } - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(channel), 0); grpc_channel_destroy(channel); grpc_completion_queue_shutdown(cq); @@ -136,9 +130,7 @@ static void run_channel_shutdown_before_timeout_test( grpc_channel* channel = fixture->create_channel(addr.c_str()); grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); - // start 1 watcher and then shut down the channel before the timer goes off - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(channel), 0); - + // start 1 watcher and then shut down the channel before the timer goes off. // expecting a 30 second timeout to go off much later than the shutdown. gpr_timespec connect_deadline = grpc_timeout_seconds_to_deadline(30); ASSERT_EQ(grpc_channel_check_connectivity_state(channel, 0), diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc index 6efaa787e8d..73a053e1196 100644 --- a/test/core/surface/sequential_connectivity_test.cc +++ b/test/core/surface/sequential_connectivity_test.cc @@ -124,9 +124,6 @@ static void run_test(const test_fixture* fixture, bool share_subchannel) { connect_deadline, cq, nullptr); grpc_event ev = grpc_completion_queue_next( cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); - // check that the watcher from "watch state" was free'd - ASSERT_EQ(grpc_channel_num_external_connectivity_watchers(channels[i]), - 0); ASSERT_EQ(ev.type, GRPC_OP_COMPLETE); ASSERT_EQ(ev.tag, nullptr); ASSERT_EQ(ev.success, true);