grpc 1.49.0.pre1-x86_64-linux → 1.50.0.pre1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +19 -16
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +32 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
@@ -167,7 +167,7 @@ void MaxAgeFilter::PostInit() {
|
|
167
167
|
max_age_activity_.Set(MakeActivity(
|
168
168
|
TrySeq(
|
169
169
|
// First sleep until the max connection age
|
170
|
-
Sleep(
|
170
|
+
Sleep(Timestamp::Now() + max_connection_age_),
|
171
171
|
// Then send a goaway.
|
172
172
|
[this] {
|
173
173
|
GRPC_CHANNEL_STACK_REF(this->channel_stack(),
|
@@ -192,7 +192,7 @@ void MaxAgeFilter::PostInit() {
|
|
192
192
|
},
|
193
193
|
// Sleep for the grace period
|
194
194
|
[this] {
|
195
|
-
return Sleep(
|
195
|
+
return Sleep(Timestamp::Now() + max_connection_age_grace_);
|
196
196
|
}),
|
197
197
|
ExecCtxWakeupScheduler(), [channel_stack, this](absl::Status status) {
|
198
198
|
// OnDone -- close the connection if the promise completed
|
@@ -246,7 +246,7 @@ void ChannelIdleFilter::StartIdleTimer() {
|
|
246
246
|
auto channel_stack = channel_stack_->Ref();
|
247
247
|
auto timeout = client_idle_timeout_;
|
248
248
|
auto promise = Loop([timeout, idle_filter_state]() {
|
249
|
-
return TrySeq(Sleep(
|
249
|
+
return TrySeq(Sleep(Timestamp::Now() + timeout),
|
250
250
|
[idle_filter_state]() -> Poll<LoopCtl<absl::Status>> {
|
251
251
|
if (idle_filter_state->CheckTimer()) {
|
252
252
|
return Continue{};
|
@@ -33,7 +33,6 @@
|
|
33
33
|
#include "src/core/lib/gprpp/time.h"
|
34
34
|
#include "src/core/lib/iomgr/closure.h"
|
35
35
|
#include "src/core/lib/iomgr/error.h"
|
36
|
-
#include "src/core/lib/iomgr/exec_ctx.h"
|
37
36
|
#include "src/core/lib/iomgr/iomgr.h"
|
38
37
|
#include "src/core/lib/iomgr/pollset.h"
|
39
38
|
#include "src/core/lib/iomgr/pollset_set.h"
|
@@ -54,7 +53,6 @@ struct backup_poller {
|
|
54
53
|
};
|
55
54
|
} // namespace
|
56
55
|
|
57
|
-
static gpr_once g_once = GPR_ONCE_INIT;
|
58
56
|
static gpr_mu g_poller_mu;
|
59
57
|
static backup_poller* g_poller = nullptr; // guarded by g_poller_mu
|
60
58
|
// g_poll_interval_ms is set only once at the first time
|
@@ -73,7 +71,7 @@ GPR_GLOBAL_CONFIG_DEFINE_INT32(
|
|
73
71
|
"turn off the backup polls.");
|
74
72
|
|
75
73
|
void grpc_client_channel_global_init_backup_polling() {
|
76
|
-
|
74
|
+
gpr_mu_init(&g_poller_mu);
|
77
75
|
int32_t poll_interval_ms =
|
78
76
|
GPR_GLOBAL_CONFIG_GET(grpc_client_channel_backup_poll_interval_ms);
|
79
77
|
if (poll_interval_ms < 0) {
|
@@ -133,11 +131,11 @@ static void run_poller(void* arg, grpc_error_handle error) {
|
|
133
131
|
return;
|
134
132
|
}
|
135
133
|
grpc_error_handle err =
|
136
|
-
grpc_pollset_work(p->pollset, nullptr, grpc_core::
|
134
|
+
grpc_pollset_work(p->pollset, nullptr, grpc_core::Timestamp::Now());
|
137
135
|
gpr_mu_unlock(p->pollset_mu);
|
138
136
|
GRPC_LOG_IF_ERROR("Run client channel backup poller", err);
|
139
137
|
grpc_timer_init(&p->polling_timer,
|
140
|
-
grpc_core::
|
138
|
+
grpc_core::Timestamp::Now() + g_poll_interval,
|
141
139
|
&p->run_poller_closure);
|
142
140
|
}
|
143
141
|
|
@@ -154,7 +152,7 @@ static void g_poller_init_locked() {
|
|
154
152
|
GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
|
155
153
|
grpc_schedule_on_exec_ctx);
|
156
154
|
grpc_timer_init(&g_poller->polling_timer,
|
157
|
-
grpc_core::
|
155
|
+
grpc_core::Timestamp::Now() + g_poll_interval,
|
158
156
|
&g_poller->run_poller_closure);
|
159
157
|
}
|
160
158
|
}
|
@@ -52,7 +52,6 @@
|
|
52
52
|
#include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
|
53
53
|
#include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
|
54
54
|
#include "src/core/ext/filters/client_channel/local_subchannel_pool.h"
|
55
|
-
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
|
56
55
|
#include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
|
57
56
|
#include "src/core/ext/filters/client_channel/retry_filter.h"
|
58
57
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
@@ -61,19 +60,20 @@
|
|
61
60
|
#include "src/core/lib/channel/channel_args.h"
|
62
61
|
#include "src/core/lib/channel/channel_stack.h"
|
63
62
|
#include "src/core/lib/channel/channel_trace.h"
|
63
|
+
#include "src/core/lib/channel/status_util.h"
|
64
64
|
#include "src/core/lib/config/core_configuration.h"
|
65
65
|
#include "src/core/lib/debug/trace.h"
|
66
66
|
#include "src/core/lib/gpr/useful.h"
|
67
67
|
#include "src/core/lib/gprpp/debug_location.h"
|
68
68
|
#include "src/core/lib/gprpp/sync.h"
|
69
69
|
#include "src/core/lib/gprpp/work_serializer.h"
|
70
|
+
#include "src/core/lib/handshaker/proxy_mapper_registry.h"
|
70
71
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
71
72
|
#include "src/core/lib/iomgr/polling_entity.h"
|
72
73
|
#include "src/core/lib/iomgr/pollset_set.h"
|
73
74
|
#include "src/core/lib/json/json.h"
|
74
75
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
75
76
|
#include "src/core/lib/load_balancing/subchannel_interface.h"
|
76
|
-
#include "src/core/lib/profiling/timers.h"
|
77
77
|
#include "src/core/lib/resolver/resolver_registry.h"
|
78
78
|
#include "src/core/lib/resolver/server_address.h"
|
79
79
|
#include "src/core/lib/service_config/service_config_call_data.h"
|
@@ -737,10 +737,14 @@ void ClientChannel::ExternalConnectivityWatcher::Notify(
|
|
737
737
|
// Hop back into the work_serializer to clean up.
|
738
738
|
// Not needed in state SHUTDOWN, because the tracker will
|
739
739
|
// automatically remove all watchers in that case.
|
740
|
+
// Note: The callback takes a ref in case the ref inside the state tracker
|
741
|
+
// gets removed before the callback runs via a SHUTDOWN notification.
|
740
742
|
if (state != GRPC_CHANNEL_SHUTDOWN) {
|
743
|
+
Ref(DEBUG_LOCATION, "RemoveWatcherLocked()").release();
|
741
744
|
chand_->work_serializer_->Run(
|
742
745
|
[this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
|
743
746
|
RemoveWatcherLocked();
|
747
|
+
Unref(DEBUG_LOCATION, "RemoveWatcherLocked()");
|
744
748
|
},
|
745
749
|
DEBUG_LOCATION);
|
746
750
|
}
|
@@ -754,9 +758,13 @@ void ClientChannel::ExternalConnectivityWatcher::Cancel() {
|
|
754
758
|
}
|
755
759
|
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_CANCELLED);
|
756
760
|
// Hop back into the work_serializer to clean up.
|
761
|
+
// Note: The callback takes a ref in case the ref inside the state tracker
|
762
|
+
// gets removed before the callback runs via a SHUTDOWN notification.
|
763
|
+
Ref(DEBUG_LOCATION, "RemoveWatcherLocked()").release();
|
757
764
|
chand_->work_serializer_->Run(
|
758
765
|
[this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
|
759
766
|
RemoveWatcherLocked();
|
767
|
+
Unref(DEBUG_LOCATION, "RemoveWatcherLocked()");
|
760
768
|
},
|
761
769
|
DEBUG_LOCATION);
|
762
770
|
}
|
@@ -1015,7 +1023,9 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
1015
1023
|
"filter");
|
1016
1024
|
return;
|
1017
1025
|
}
|
1018
|
-
uri_to_resolve_ =
|
1026
|
+
uri_to_resolve_ = CoreConfiguration::Get()
|
1027
|
+
.proxy_mapper_registry()
|
1028
|
+
.MapName(*server_uri, &channel_args_)
|
1019
1029
|
.value_or(*server_uri);
|
1020
1030
|
// Make sure the URI to resolve is valid, so that we know that
|
1021
1031
|
// resolver creation will succeed later.
|
@@ -1112,8 +1122,9 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
|
|
1112
1122
|
policy_name = resolver_result.args.GetString(GRPC_ARG_LB_POLICY_NAME);
|
1113
1123
|
bool requires_config = false;
|
1114
1124
|
if (policy_name.has_value() &&
|
1115
|
-
(!
|
1116
|
-
|
1125
|
+
(!CoreConfiguration::Get()
|
1126
|
+
.lb_policy_registry()
|
1127
|
+
.LoadBalancingPolicyExists(*policy_name, &requires_config) ||
|
1117
1128
|
requires_config)) {
|
1118
1129
|
if (requires_config) {
|
1119
1130
|
gpr_log(GPR_ERROR,
|
@@ -1137,7 +1148,8 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
|
|
1137
1148
|
{std::string(*policy_name), Json::Object{}},
|
1138
1149
|
}};
|
1139
1150
|
auto lb_policy_config =
|
1140
|
-
|
1151
|
+
CoreConfiguration::Get().lb_policy_registry().ParseLoadBalancingConfig(
|
1152
|
+
config_json);
|
1141
1153
|
// The policy name came from one of three places:
|
1142
1154
|
// - The deprecated loadBalancingPolicy field in the service config,
|
1143
1155
|
// in which case the code in ClientChannelServiceConfigParser
|
@@ -1159,6 +1171,9 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|
1159
1171
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
|
1160
1172
|
gpr_log(GPR_INFO, "chand=%p: got resolver result", this);
|
1161
1173
|
}
|
1174
|
+
// Grab resolver result health callback.
|
1175
|
+
auto resolver_callback = std::move(result.result_health_callback);
|
1176
|
+
absl::Status resolver_result_status;
|
1162
1177
|
// We only want to trace the address resolution in the follow cases:
|
1163
1178
|
// (a) Address resolution resulted in service config change.
|
1164
1179
|
// (b) Address resolution that causes number of backends to go from
|
@@ -1210,6 +1225,8 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|
1210
1225
|
// TRANSIENT_FAILURE.
|
1211
1226
|
OnResolverErrorLocked(result.service_config.status());
|
1212
1227
|
trace_strings.push_back("no valid service config");
|
1228
|
+
resolver_result_status =
|
1229
|
+
absl::UnavailableError("no valid service config");
|
1213
1230
|
}
|
1214
1231
|
} else if (*result.service_config == nullptr) {
|
1215
1232
|
// Resolver did not return any service config.
|
@@ -1254,7 +1271,7 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|
1254
1271
|
gpr_log(GPR_INFO, "chand=%p: service config not changed", this);
|
1255
1272
|
}
|
1256
1273
|
// Create or update LB policy, as needed.
|
1257
|
-
CreateOrUpdateLbPolicyLocked(
|
1274
|
+
resolver_result_status = CreateOrUpdateLbPolicyLocked(
|
1258
1275
|
std::move(lb_policy_config),
|
1259
1276
|
parsed_service_config->health_check_service_name(), std::move(result));
|
1260
1277
|
if (service_config_changed || config_selector_changed) {
|
@@ -1268,6 +1285,10 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|
1268
1285
|
trace_strings.push_back("Service config changed");
|
1269
1286
|
}
|
1270
1287
|
}
|
1288
|
+
// Invoke resolver callback if needed.
|
1289
|
+
if (resolver_callback != nullptr) {
|
1290
|
+
resolver_callback(std::move(resolver_result_status));
|
1291
|
+
}
|
1271
1292
|
// Add channel trace event.
|
1272
1293
|
if (!trace_strings.empty()) {
|
1273
1294
|
std::string message =
|
@@ -1293,7 +1314,8 @@ void ClientChannel::OnResolverErrorLocked(absl::Status status) {
|
|
1293
1314
|
{
|
1294
1315
|
MutexLock lock(&resolution_mu_);
|
1295
1316
|
// Update resolver transient failure.
|
1296
|
-
resolver_transient_failure_error_ =
|
1317
|
+
resolver_transient_failure_error_ =
|
1318
|
+
MaybeRewriteIllegalStatusCode(status, "resolver");
|
1297
1319
|
// Process calls that were queued waiting for the resolver result.
|
1298
1320
|
for (ResolverQueuedCall* call = resolver_queued_calls_; call != nullptr;
|
1299
1321
|
call = call->next) {
|
@@ -1313,7 +1335,7 @@ void ClientChannel::OnResolverErrorLocked(absl::Status status) {
|
|
1313
1335
|
}
|
1314
1336
|
}
|
1315
1337
|
|
1316
|
-
|
1338
|
+
absl::Status ClientChannel::CreateOrUpdateLbPolicyLocked(
|
1317
1339
|
RefCountedPtr<LoadBalancingPolicy::Config> lb_policy_config,
|
1318
1340
|
const absl::optional<std::string>& health_check_service_name,
|
1319
1341
|
Resolver::Result result) {
|
@@ -1340,7 +1362,7 @@ void ClientChannel::CreateOrUpdateLbPolicyLocked(
|
|
1340
1362
|
gpr_log(GPR_INFO, "chand=%p: Updating child policy %p", this,
|
1341
1363
|
lb_policy_.get());
|
1342
1364
|
}
|
1343
|
-
lb_policy_->UpdateLocked(std::move(update_args));
|
1365
|
+
return lb_policy_->UpdateLocked(std::move(update_args));
|
1344
1366
|
}
|
1345
1367
|
|
1346
1368
|
// Creates a new LB policy.
|
@@ -1392,8 +1414,7 @@ void ClientChannel::UpdateServiceConfigInControlPlaneLocked(
|
|
1392
1414
|
RefCountedPtr<ConfigSelector> config_selector, std::string lb_policy_name) {
|
1393
1415
|
std::string service_config_json(service_config->json_string());
|
1394
1416
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
|
1395
|
-
gpr_log(GPR_INFO,
|
1396
|
-
"chand=%p: resolver returned updated service config: \"%s\"", this,
|
1417
|
+
gpr_log(GPR_INFO, "chand=%p: using service config: \"%s\"", this,
|
1397
1418
|
service_config_json.c_str());
|
1398
1419
|
}
|
1399
1420
|
// Save service config.
|
@@ -1852,7 +1873,6 @@ void ClientChannel::CallData::Destroy(
|
|
1852
1873
|
|
1853
1874
|
void ClientChannel::CallData::StartTransportStreamOpBatch(
|
1854
1875
|
grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
|
1855
|
-
GPR_TIMER_SCOPE("cc_start_transport_stream_op_batch", 0);
|
1856
1876
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
1857
1877
|
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
1858
1878
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace) &&
|
@@ -2165,7 +2185,8 @@ grpc_error_handle ClientChannel::CallData::ApplyServiceConfigToCallLocked(
|
|
2165
2185
|
ConfigSelector::CallConfig call_config =
|
2166
2186
|
config_selector->GetCallConfig({&path_, initial_metadata, arena_});
|
2167
2187
|
if (!call_config.status.ok()) {
|
2168
|
-
return absl_status_to_grpc_error(
|
2188
|
+
return absl_status_to_grpc_error(MaybeRewriteIllegalStatusCode(
|
2189
|
+
std::move(call_config.status), "ConfigSelector"));
|
2169
2190
|
}
|
2170
2191
|
// Create a ClientChannelServiceConfigCallData for the call. This stores
|
2171
2192
|
// a ref to the ServiceConfig and caches the right set of parsed configs
|
@@ -3158,11 +3179,8 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
|
|
3158
3179
|
// attempt's final status.
|
3159
3180
|
if (!initial_metadata_batch->GetOrCreatePointer(WaitForReady())
|
3160
3181
|
->value) {
|
3161
|
-
|
3162
|
-
|
3163
|
-
*error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
3164
|
-
"Failed to pick subchannel", &lb_error, 1);
|
3165
|
-
GRPC_ERROR_UNREF(lb_error);
|
3182
|
+
*error = absl_status_to_grpc_error(MaybeRewriteIllegalStatusCode(
|
3183
|
+
std::move(fail_pick->status), "LB pick"));
|
3166
3184
|
MaybeRemoveCallFromLbQueuedCallsLocked();
|
3167
3185
|
return true;
|
3168
3186
|
}
|
@@ -3178,9 +3196,10 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
|
|
3178
3196
|
gpr_log(GPR_INFO, "chand=%p lb_call=%p: LB pick dropped: %s",
|
3179
3197
|
chand_, this, drop_pick->status.ToString().c_str());
|
3180
3198
|
}
|
3181
|
-
*error =
|
3182
|
-
|
3183
|
-
|
3199
|
+
*error = grpc_error_set_int(
|
3200
|
+
absl_status_to_grpc_error(MaybeRewriteIllegalStatusCode(
|
3201
|
+
std::move(drop_pick->status), "LB drop")),
|
3202
|
+
GRPC_ERROR_INT_LB_POLICY_DROP, 1);
|
3184
3203
|
MaybeRemoveCallFromLbQueuedCallsLocked();
|
3185
3204
|
return true;
|
3186
3205
|
});
|
@@ -250,7 +250,7 @@ class ClientChannel {
|
|
250
250
|
void OnResolverErrorLocked(absl::Status status)
|
251
251
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_);
|
252
252
|
|
253
|
-
|
253
|
+
absl::Status CreateOrUpdateLbPolicyLocked(
|
254
254
|
RefCountedPtr<LoadBalancingPolicy::Config> lb_policy_config,
|
255
255
|
const absl::optional<std::string>& health_check_service_name,
|
256
256
|
Resolver::Result result) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_);
|
@@ -18,30 +18,14 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
-
#include "src/core/ext/filters/client_channel/backup_poller.h"
|
22
21
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
23
|
-
#include "src/core/ext/filters/client_channel/http_proxy.h"
|
24
|
-
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
|
25
22
|
#include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
|
26
23
|
#include "src/core/ext/filters/client_channel/retry_service_config.h"
|
27
24
|
#include "src/core/lib/channel/channel_stack_builder.h"
|
28
25
|
#include "src/core/lib/config/core_configuration.h"
|
29
|
-
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
30
26
|
#include "src/core/lib/surface/channel_init.h"
|
31
27
|
#include "src/core/lib/surface/channel_stack_type.h"
|
32
28
|
|
33
|
-
void grpc_client_channel_init(void) {
|
34
|
-
grpc_core::LoadBalancingPolicyRegistry::Builder::InitRegistry();
|
35
|
-
grpc_core::ProxyMapperRegistry::Init();
|
36
|
-
grpc_core::RegisterHttpProxyMapper();
|
37
|
-
grpc_client_channel_global_init_backup_polling();
|
38
|
-
}
|
39
|
-
|
40
|
-
void grpc_client_channel_shutdown(void) {
|
41
|
-
grpc_core::ProxyMapperRegistry::Shutdown();
|
42
|
-
grpc_core::LoadBalancingPolicyRegistry::Builder::ShutdownRegistry();
|
43
|
-
}
|
44
|
-
|
45
29
|
namespace grpc_core {
|
46
30
|
|
47
31
|
void BuildClientChannelConfiguration(CoreConfiguration::Builder* builder) {
|
@@ -39,12 +39,12 @@
|
|
39
39
|
#include <grpc/support/alloc.h>
|
40
40
|
#include <grpc/support/log.h>
|
41
41
|
|
42
|
-
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
|
43
42
|
#include "src/core/lib/channel/channel_args.h"
|
44
|
-
#include "src/core/lib/gpr/env.h"
|
45
43
|
#include "src/core/lib/gpr/string.h"
|
44
|
+
#include "src/core/lib/gprpp/env.h"
|
46
45
|
#include "src/core/lib/gprpp/host_port.h"
|
47
46
|
#include "src/core/lib/gprpp/memory.h"
|
47
|
+
#include "src/core/lib/handshaker/proxy_mapper_registry.h"
|
48
48
|
#include "src/core/lib/iomgr/resolve_address.h"
|
49
49
|
#include "src/core/lib/slice/b64.h"
|
50
50
|
#include "src/core/lib/transport/http_connect_handshaker.h"
|
@@ -73,16 +73,9 @@ absl::optional<std::string> GetHttpProxyServer(
|
|
73
73
|
*/
|
74
74
|
absl::optional<std::string> uri_str =
|
75
75
|
args.GetOwnedString(GRPC_ARG_HTTP_PROXY);
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
std::string s(v);
|
80
|
-
gpr_free(v);
|
81
|
-
return s;
|
82
|
-
};
|
83
|
-
if (!uri_str.has_value()) uri_str = get_env("grpc_proxy");
|
84
|
-
if (!uri_str.has_value()) uri_str = get_env("https_proxy");
|
85
|
-
if (!uri_str.has_value()) uri_str = get_env("http_proxy");
|
76
|
+
if (!uri_str.has_value()) uri_str = GetEnv("grpc_proxy");
|
77
|
+
if (!uri_str.has_value()) uri_str = GetEnv("https_proxy");
|
78
|
+
if (!uri_str.has_value()) uri_str = GetEnv("http_proxy");
|
86
79
|
if (!uri_str.has_value()) return absl::nullopt;
|
87
80
|
// an emtpy value means "don't use proxy"
|
88
81
|
if (uri_str->empty()) return absl::nullopt;
|
@@ -158,11 +151,11 @@ absl::optional<std::string> HttpProxyMapper::MapName(
|
|
158
151
|
return absl::nullopt;
|
159
152
|
}
|
160
153
|
/* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */
|
161
|
-
auto no_proxy_str =
|
162
|
-
if (no_proxy_str
|
163
|
-
no_proxy_str =
|
154
|
+
auto no_proxy_str = GetEnv("no_grpc_proxy");
|
155
|
+
if (!no_proxy_str.has_value()) {
|
156
|
+
no_proxy_str = GetEnv("no_proxy");
|
164
157
|
}
|
165
|
-
if (no_proxy_str
|
158
|
+
if (no_proxy_str.has_value()) {
|
166
159
|
bool use_proxy = true;
|
167
160
|
std::string server_host;
|
168
161
|
std::string server_port;
|
@@ -174,7 +167,7 @@ absl::optional<std::string> HttpProxyMapper::MapName(
|
|
174
167
|
std::string(server_uri).c_str());
|
175
168
|
} else {
|
176
169
|
std::vector<absl::string_view> no_proxy_hosts =
|
177
|
-
absl::StrSplit(no_proxy_str
|
170
|
+
absl::StrSplit(*no_proxy_str, ',', absl::SkipEmpty());
|
178
171
|
for (const auto& no_proxy_entry : no_proxy_hosts) {
|
179
172
|
if (absl::EndsWithIgnoreCase(server_host, no_proxy_entry)) {
|
180
173
|
gpr_log(GPR_INFO, "not using proxy for host in no_proxy list '%s'",
|
@@ -199,8 +192,8 @@ absl::optional<std::string> HttpProxyMapper::MapName(
|
|
199
192
|
return name_to_resolve;
|
200
193
|
}
|
201
194
|
|
202
|
-
void RegisterHttpProxyMapper() {
|
203
|
-
|
195
|
+
void RegisterHttpProxyMapper(CoreConfiguration::Builder* builder) {
|
196
|
+
builder->proxy_mapper_registry()->Register(
|
204
197
|
true /* at_start */,
|
205
198
|
std::unique_ptr<ProxyMapperInterface>(new HttpProxyMapper()));
|
206
199
|
}
|
@@ -26,8 +26,9 @@
|
|
26
26
|
#include "absl/strings/string_view.h"
|
27
27
|
#include "absl/types/optional.h"
|
28
28
|
|
29
|
-
#include "src/core/ext/filters/client_channel/proxy_mapper.h"
|
30
29
|
#include "src/core/lib/channel/channel_args.h"
|
30
|
+
#include "src/core/lib/config/core_configuration.h"
|
31
|
+
#include "src/core/lib/handshaker/proxy_mapper.h"
|
31
32
|
#include "src/core/lib/iomgr/resolved_address.h"
|
32
33
|
|
33
34
|
namespace grpc_core {
|
@@ -44,7 +45,7 @@ class HttpProxyMapper : public ProxyMapperInterface {
|
|
44
45
|
}
|
45
46
|
};
|
46
47
|
|
47
|
-
void RegisterHttpProxyMapper();
|
48
|
+
void RegisterHttpProxyMapper(CoreConfiguration::Builder* builder);
|
48
49
|
|
49
50
|
} // namespace grpc_core
|
50
51
|
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#include <grpc/support/log.h>
|
30
30
|
|
31
31
|
#include "src/core/lib/channel/channel_args.h"
|
32
|
+
#include "src/core/lib/config/core_configuration.h"
|
32
33
|
#include "src/core/lib/gprpp/debug_location.h"
|
33
34
|
#include "src/core/lib/iomgr/pollset_set.h"
|
34
35
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
@@ -160,7 +161,7 @@ void ChildPolicyHandler::ShutdownLocked() {
|
|
160
161
|
}
|
161
162
|
}
|
162
163
|
|
163
|
-
|
164
|
+
absl::Status ChildPolicyHandler::UpdateLocked(UpdateArgs args) {
|
164
165
|
// If the child policy name changes, we need to create a new child
|
165
166
|
// policy. When this happens, we leave child_policy_ as-is and store
|
166
167
|
// the new child policy in pending_child_policy_. Once the new child
|
@@ -252,7 +253,7 @@ void ChildPolicyHandler::UpdateLocked(UpdateArgs args) {
|
|
252
253
|
policy_to_update == pending_child_policy_.get() ? "pending " : "",
|
253
254
|
policy_to_update);
|
254
255
|
}
|
255
|
-
policy_to_update->UpdateLocked(std::move(args));
|
256
|
+
return policy_to_update->UpdateLocked(std::move(args));
|
256
257
|
}
|
257
258
|
|
258
259
|
void ChildPolicyHandler::ExitIdleLocked() {
|
@@ -311,8 +312,9 @@ bool ChildPolicyHandler::ConfigChangeRequiresNewPolicyInstance(
|
|
311
312
|
OrphanablePtr<LoadBalancingPolicy>
|
312
313
|
ChildPolicyHandler::CreateLoadBalancingPolicy(
|
313
314
|
absl::string_view name, LoadBalancingPolicy::Args args) const {
|
314
|
-
return
|
315
|
-
|
315
|
+
return CoreConfiguration::Get()
|
316
|
+
.lb_policy_registry()
|
317
|
+
.CreateLoadBalancingPolicy(name, std::move(args));
|
316
318
|
}
|
317
319
|
|
318
320
|
} // namespace grpc_core
|
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
#include <utility>
|
22
22
|
|
23
|
+
#include "absl/status/status.h"
|
23
24
|
#include "absl/strings/string_view.h"
|
24
25
|
|
25
26
|
#include "src/core/lib/channel/channel_args.h"
|
@@ -33,9 +34,9 @@ namespace grpc_core {
|
|
33
34
|
// A class that makes it easy to gracefully switch child policies.
|
34
35
|
//
|
35
36
|
// Callers should instantiate this instead of using
|
36
|
-
//
|
37
|
-
// instantiated, this object will automatically take care of
|
38
|
-
//
|
37
|
+
// CoreConfiguration::Get().lb_policy_registry().CreateLoadBalancingPolicy().
|
38
|
+
// Once instantiated, this object will automatically take care of constructing
|
39
|
+
// the child policy as needed upon receiving an update.
|
39
40
|
class ChildPolicyHandler : public LoadBalancingPolicy {
|
40
41
|
public:
|
41
42
|
ChildPolicyHandler(Args args, TraceFlag* tracer)
|
@@ -43,7 +44,7 @@ class ChildPolicyHandler : public LoadBalancingPolicy {
|
|
43
44
|
|
44
45
|
absl::string_view name() const override { return "child_policy_handler"; }
|
45
46
|
|
46
|
-
|
47
|
+
absl::Status UpdateLocked(UpdateArgs args) override;
|
47
48
|
void ExitIdleLocked() override;
|
48
49
|
void ResetBackoffLocked() override;
|
49
50
|
|
@@ -31,7 +31,6 @@
|
|
31
31
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
32
32
|
#include "src/core/lib/iomgr/closure.h"
|
33
33
|
#include "src/core/lib/iomgr/error.h"
|
34
|
-
#include "src/core/lib/profiling/timers.h"
|
35
34
|
#include "src/core/lib/transport/metadata_batch.h"
|
36
35
|
#include "src/core/lib/transport/transport.h"
|
37
36
|
|
@@ -102,7 +101,6 @@ static void clr_destroy_call_elem(grpc_call_element* elem,
|
|
102
101
|
static void clr_start_transport_stream_op_batch(
|
103
102
|
grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
|
104
103
|
call_data* calld = static_cast<call_data*>(elem->call_data);
|
105
|
-
GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0);
|
106
104
|
// Handle send_initial_metadata.
|
107
105
|
if (batch->send_initial_metadata) {
|
108
106
|
// Grab client stats object from metadata.
|