grpc 1.25.0 → 1.26.0.pre1
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 +782 -291
- data/include/grpc/impl/codegen/grpc_types.h +4 -0
- data/include/grpc/impl/codegen/port_platform.h +7 -0
- data/include/grpc/support/alloc.h +0 -16
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
- data/src/core/ext/filters/client_channel/backup_poller.cc +1 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +95 -88
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +7 -7
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +4 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -3
- data/src/core/ext/filters/client_channel/connector.h +40 -45
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +10 -10
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -13
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +66 -37
- data/src/core/ext/filters/client_channel/http_proxy.cc +107 -116
- data/src/core/ext/filters/client_channel/http_proxy.h +5 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +9 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +10 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +18 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +4 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +6 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +368 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +157 -77
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +5 -5
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +8 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.h +14 -34
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +46 -79
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +23 -17
- data/src/core/ext/filters/client_channel/resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +13 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +3 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +9 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +17 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +9 -9
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -3
- data/src/core/ext/filters/client_channel/resolver_registry.cc +14 -12
- data/src/core/ext/filters/client_channel/resolver_registry.h +6 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -6
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +6 -6
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +5 -5
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +3 -3
- data/src/core/ext/filters/client_channel/service_config.cc +15 -14
- data/src/core/ext/filters/client_channel/service_config.h +14 -19
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -36
- data/src/core/ext/filters/client_channel/subchannel.h +11 -12
- data/src/core/ext/filters/client_channel/subchannel_interface.h +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_api.h +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +3 -3
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +6 -5
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +58 -31
- data/src/core/ext/filters/client_channel/xds/xds_client.h +20 -15
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +5 -3
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +18 -15
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +10 -10
- data/src/core/ext/filters/deadline/deadline_filter.cc +15 -13
- data/src/core/ext/filters/http/client/http_client_filter.cc +12 -12
- data/src/core/ext/filters/http/client_authority_filter.cc +3 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +13 -7
- data/src/core/ext/filters/http/server/http_server_filter.cc +14 -13
- data/src/core/ext/filters/max_age/max_age_filter.cc +16 -14
- data/src/core/ext/filters/message_size/message_size_filter.cc +10 -8
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +9 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +141 -174
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +31 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +7 -6
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +14 -12
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +46 -38
- data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -5
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +11 -8
- data/src/core/ext/transport/chttp2/transport/internal.h +3 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +65 -41
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +141 -70
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +352 -118
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +8 -4
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +16 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +12 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +13 -12
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -24
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +5 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +13 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +48 -44
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -1
- data/src/core/lib/avl/avl.cc +1 -1
- data/src/core/lib/channel/channel_stack.cc +1 -1
- data/src/core/lib/channel/channel_stack.h +16 -4
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channelz.cc +46 -46
- data/src/core/lib/channel/channelz.h +37 -35
- data/src/core/lib/channel/channelz_registry.cc +2 -2
- data/src/core/lib/channel/channelz_registry.h +1 -1
- data/src/core/lib/channel/connected_channel.cc +3 -2
- data/src/core/lib/channel/handshaker.cc +1 -1
- data/src/core/lib/channel/handshaker_registry.cc +5 -5
- data/src/core/lib/channel/handshaker_registry.h +3 -3
- data/src/core/lib/compression/message_compress.cc +3 -2
- data/src/core/lib/compression/stream_compression_identity.cc +5 -7
- data/src/core/lib/gpr/alloc.cc +4 -29
- data/src/core/lib/gpr/cpu_linux.cc +1 -1
- data/src/core/lib/gprpp/fork.cc +4 -4
- data/src/core/lib/gprpp/global_config_env.cc +7 -7
- data/src/core/lib/gprpp/global_config_env.h +2 -2
- data/src/core/lib/gprpp/host_port.cc +8 -8
- data/src/core/lib/gprpp/host_port.h +3 -3
- data/src/core/lib/gprpp/inlined_vector.h +13 -0
- data/src/core/lib/gprpp/map.h +2 -9
- data/src/core/lib/gprpp/memory.h +12 -98
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +1 -1
- data/src/core/lib/gprpp/string_view.h +45 -23
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/gprpp/thd_posix.cc +6 -5
- data/src/core/lib/gprpp/thd_windows.cc +3 -3
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli_security_connector.cc +3 -3
- data/src/core/lib/iomgr/buffer_list.cc +10 -5
- data/src/core/lib/iomgr/call_combiner.cc +7 -6
- data/src/core/lib/iomgr/call_combiner.h +4 -3
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/closure.h +33 -135
- data/src/core/lib/iomgr/combiner.cc +10 -17
- data/src/core/lib/iomgr/combiner.h +0 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
- data/src/core/lib/iomgr/ev_epollex_linux.cc +23 -13
- data/src/core/lib/iomgr/ev_poll_posix.cc +30 -17
- data/src/core/lib/iomgr/exec_ctx.cc +52 -5
- data/src/core/lib/iomgr/exec_ctx.h +6 -2
- data/src/core/lib/iomgr/executor.cc +16 -37
- data/src/core/lib/iomgr/executor.h +4 -7
- data/src/core/lib/iomgr/executor/threadpool.cc +4 -4
- data/src/core/lib/iomgr/iomgr_custom.cc +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +9 -8
- data/src/core/lib/iomgr/logical_thread.cc +103 -0
- data/src/core/lib/iomgr/logical_thread.h +52 -0
- data/src/core/lib/iomgr/pollset_custom.cc +5 -5
- data/src/core/lib/iomgr/pollset_set_custom.cc +9 -9
- data/src/core/lib/iomgr/pollset_windows.cc +16 -2
- data/src/core/lib/iomgr/port.h +3 -0
- data/src/core/lib/iomgr/resolve_address_custom.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_posix.cc +8 -9
- data/src/core/lib/iomgr/resolve_address_windows.cc +4 -6
- data/src/core/lib/iomgr/resource_quota.cc +26 -21
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +11 -0
- data/src/core/lib/iomgr/socket_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_custom.cc +10 -9
- data/src/core/lib/iomgr/tcp_posix.cc +19 -15
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -2
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +5 -3
- data/src/core/lib/iomgr/tcp_windows.cc +16 -13
- data/src/core/lib/iomgr/timer_custom.cc +4 -3
- data/src/core/lib/iomgr/timer_generic.cc +11 -9
- data/src/core/lib/iomgr/udp_server.cc +16 -13
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +8 -5
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +45 -57
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -6
- data/src/core/lib/security/credentials/credentials.cc +8 -8
- data/src/core/lib/security/credentials/credentials.h +5 -5
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +13 -11
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +4 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +5 -5
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +2 -2
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +28 -22
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +8 -8
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +9 -9
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -4
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -15
- data/src/core/lib/security/transport/client_auth_filter.cc +4 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -8
- data/src/core/lib/security/transport/security_handshaker.cc +67 -23
- data/src/core/lib/security/transport/server_auth_filter.cc +6 -5
- data/src/core/lib/security/transport/target_authority_table.h +1 -1
- data/src/core/lib/slice/b64.cc +3 -4
- data/src/core/lib/slice/b64.h +1 -2
- data/src/core/lib/slice/slice.cc +8 -13
- data/src/core/lib/surface/call.cc +19 -19
- data/src/core/lib/surface/call.h +6 -7
- data/src/core/lib/surface/call_log_batch.cc +1 -2
- data/src/core/lib/surface/channel.cc +17 -18
- data/src/core/lib/surface/channel.h +4 -19
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +21 -22
- data/src/core/lib/surface/completion_queue_factory.cc +1 -1
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/init_secure.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +10 -12
- data/src/core/lib/surface/server.cc +24 -18
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +2 -1
- data/src/core/lib/transport/connectivity_state.cc +4 -4
- data/src/core/lib/transport/connectivity_state.h +2 -2
- data/src/core/lib/transport/metadata.cc +8 -10
- data/src/core/lib/transport/metadata.h +5 -8
- data/src/core/lib/transport/metadata_batch.cc +6 -0
- data/src/core/lib/transport/static_metadata.cc +2 -4
- data/src/core/lib/transport/status_metadata.cc +7 -0
- data/src/core/lib/transport/status_metadata.h +18 -0
- data/src/core/lib/transport/transport.cc +9 -7
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +292 -43
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +197 -46
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +4 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +5 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +2 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -4
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +0 -6
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/upb/upb/decode.c +1 -0
- metadata +34 -32
- data/src/core/ext/filters/client_channel/connector.cc +0 -41
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +0 -48
- data/src/core/lib/gprpp/set.h +0 -33
@@ -726,6 +726,10 @@ typedef struct grpc_experimental_completion_queue_functor {
|
|
726
726
|
operation succeeded (non-zero) or failed (zero) */
|
727
727
|
void (*functor_run)(struct grpc_experimental_completion_queue_functor*, int);
|
728
728
|
|
729
|
+
/** The inlineable member specifies whether this functor can be run inline.
|
730
|
+
This should only be used for trivial internally-defined functors. */
|
731
|
+
int inlineable;
|
732
|
+
|
729
733
|
/** The following fields are not API. They are meant for internal use. */
|
730
734
|
int internal_success;
|
731
735
|
struct grpc_experimental_completion_queue_functor* internal_next;
|
@@ -27,6 +27,13 @@
|
|
27
27
|
* - some syscalls to be made directly
|
28
28
|
*/
|
29
29
|
|
30
|
+
/*
|
31
|
+
* Defines GRPC_USE_ABSL to use Abseil Common Libraries (C++)
|
32
|
+
*/
|
33
|
+
#ifndef GRPC_USE_ABSL
|
34
|
+
#define GRPC_USE_ABSL 0
|
35
|
+
#endif
|
36
|
+
|
30
37
|
/* Get windows.h included everywhere (we need it) */
|
31
38
|
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
|
32
39
|
#ifndef WIN32_LEAN_AND_MEAN
|
@@ -27,13 +27,6 @@
|
|
27
27
|
extern "C" {
|
28
28
|
#endif
|
29
29
|
|
30
|
-
typedef struct gpr_allocation_functions {
|
31
|
-
void* (*malloc_fn)(size_t size);
|
32
|
-
void* (*zalloc_fn)(size_t size); /** if NULL, uses malloc_fn then memset */
|
33
|
-
void* (*realloc_fn)(void* ptr, size_t size);
|
34
|
-
void (*free_fn)(void* ptr);
|
35
|
-
} gpr_allocation_functions;
|
36
|
-
|
37
30
|
/** malloc.
|
38
31
|
* If size==0, always returns NULL. Otherwise this function never returns NULL.
|
39
32
|
* The pointer returned is suitably aligned for any kind of variable it could
|
@@ -52,15 +45,6 @@ GPRAPI void* gpr_malloc_aligned(size_t size, size_t alignment);
|
|
52
45
|
/** free memory allocated by gpr_malloc_aligned */
|
53
46
|
GPRAPI void gpr_free_aligned(void* ptr);
|
54
47
|
|
55
|
-
/** Request the family of allocation functions in \a functions be used. NOTE
|
56
|
-
* that this request will be honored in a *best effort* basis and that no
|
57
|
-
* guarantees are made about the default functions (eg, malloc) being called.
|
58
|
-
* The functions.free_fn implementation must be a no-op for NULL input. */
|
59
|
-
GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions);
|
60
|
-
|
61
|
-
/** Return the family of allocation functions currently in effect. */
|
62
|
-
GPRAPI gpr_allocation_functions gpr_get_allocation_functions(void);
|
63
|
-
|
64
48
|
#ifdef __cplusplus
|
65
49
|
}
|
66
50
|
#endif
|
@@ -26,12 +26,12 @@ namespace grpc_core {
|
|
26
26
|
namespace {
|
27
27
|
|
28
28
|
template <typename EntryType>
|
29
|
-
|
29
|
+
std::map<StringView, double, StringLess> ParseMap(
|
30
30
|
udpa_data_orca_v1_OrcaLoadReport* msg,
|
31
31
|
EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
|
32
32
|
upb_strview (*key_func)(const EntryType*),
|
33
33
|
double (*value_func)(const EntryType*), Arena* arena) {
|
34
|
-
|
34
|
+
std::map<StringView, double, StringLess> result;
|
35
35
|
size_t size;
|
36
36
|
const auto* const* entries = entry_func(msg, &size);
|
37
37
|
for (size_t i = 0; i < size; ++i) {
|
@@ -89,7 +89,7 @@ static void backup_poller_shutdown_unref(backup_poller* p) {
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
92
|
-
static void done_poller(void* arg, grpc_error* error) {
|
92
|
+
static void done_poller(void* arg, grpc_error* /*error*/) {
|
93
93
|
backup_poller_shutdown_unref(static_cast<backup_poller*>(arg));
|
94
94
|
}
|
95
95
|
|
@@ -90,7 +90,7 @@ static void delete_state_watcher(state_watcher* w) {
|
|
90
90
|
gpr_free(w);
|
91
91
|
}
|
92
92
|
|
93
|
-
static void finished_completion(void* pw, grpc_cq_completion* ignored) {
|
93
|
+
static void finished_completion(void* pw, grpc_cq_completion* /*ignored*/) {
|
94
94
|
bool should_delete = false;
|
95
95
|
state_watcher* w = static_cast<state_watcher*>(pw);
|
96
96
|
gpr_mu_lock(&w->mu);
|
@@ -198,7 +198,7 @@ typedef struct watcher_timer_init_arg {
|
|
198
198
|
gpr_timespec deadline;
|
199
199
|
} watcher_timer_init_arg;
|
200
200
|
|
201
|
-
static void watcher_timer_init(void* arg, grpc_error* error_ignored) {
|
201
|
+
static void watcher_timer_init(void* arg, grpc_error* /*error_ignored*/) {
|
202
202
|
watcher_timer_init_arg* wa = static_cast<watcher_timer_init_arg*>(arg);
|
203
203
|
|
204
204
|
grpc_timer_init(&wa->w->alarm, grpc_timespec_to_millis_round_up(wa->deadline),
|
@@ -26,6 +26,8 @@
|
|
26
26
|
#include <stdio.h>
|
27
27
|
#include <string.h>
|
28
28
|
|
29
|
+
#include <set>
|
30
|
+
|
29
31
|
#include <grpc/support/alloc.h>
|
30
32
|
#include <grpc/support/log.h>
|
31
33
|
#include <grpc/support/string_util.h>
|
@@ -53,7 +55,6 @@
|
|
53
55
|
#include "src/core/lib/gprpp/inlined_vector.h"
|
54
56
|
#include "src/core/lib/gprpp/manual_constructor.h"
|
55
57
|
#include "src/core/lib/gprpp/map.h"
|
56
|
-
#include "src/core/lib/gprpp/set.h"
|
57
58
|
#include "src/core/lib/gprpp/sync.h"
|
58
59
|
#include "src/core/lib/iomgr/combiner.h"
|
59
60
|
#include "src/core/lib/iomgr/iomgr.h"
|
@@ -161,7 +162,7 @@ class ChannelData {
|
|
161
162
|
MutexLock lock(&external_watchers_mu_);
|
162
163
|
// Will be deleted when the watch is complete.
|
163
164
|
GPR_ASSERT(external_watchers_[on_complete] == nullptr);
|
164
|
-
external_watchers_[on_complete] =
|
165
|
+
external_watchers_[on_complete] = new ExternalConnectivityWatcher(
|
165
166
|
this, pollent, state, on_complete, watcher_timer_init);
|
166
167
|
}
|
167
168
|
|
@@ -227,7 +228,7 @@ class ChannelData {
|
|
227
228
|
|
228
229
|
void UpdateStateAndPickerLocked(
|
229
230
|
grpc_connectivity_state state, const char* reason,
|
230
|
-
|
231
|
+
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker);
|
231
232
|
|
232
233
|
void UpdateServiceConfigLocked(
|
233
234
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data,
|
@@ -251,7 +252,7 @@ class ChannelData {
|
|
251
252
|
void ProcessLbPolicy(
|
252
253
|
const Resolver::Result& resolver_result,
|
253
254
|
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
254
|
-
UniquePtr<char>* lb_policy_name,
|
255
|
+
grpc_core::UniquePtr<char>* lb_policy_name,
|
255
256
|
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config);
|
256
257
|
|
257
258
|
//
|
@@ -264,15 +265,15 @@ class ChannelData {
|
|
264
265
|
ClientChannelFactory* client_channel_factory_;
|
265
266
|
const grpc_channel_args* channel_args_;
|
266
267
|
RefCountedPtr<ServiceConfig> default_service_config_;
|
267
|
-
UniquePtr<char> server_name_;
|
268
|
-
UniquePtr<char> target_uri_;
|
268
|
+
grpc_core::UniquePtr<char> server_name_;
|
269
|
+
grpc_core::UniquePtr<char> target_uri_;
|
269
270
|
channelz::ChannelNode* channelz_node_;
|
270
271
|
|
271
272
|
//
|
272
273
|
// Fields used in the data plane. Guarded by data_plane_mu.
|
273
274
|
//
|
274
275
|
mutable Mutex data_plane_mu_;
|
275
|
-
|
276
|
+
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker_;
|
276
277
|
QueuedPick* queued_picks_ = nullptr; // Linked list of queued picks.
|
277
278
|
// Data from service config.
|
278
279
|
bool received_service_config_data_ = false;
|
@@ -287,20 +288,20 @@ class ChannelData {
|
|
287
288
|
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
|
288
289
|
OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
|
289
290
|
ConnectivityStateTracker state_tracker_;
|
290
|
-
UniquePtr<char> health_check_service_name_;
|
291
|
+
grpc_core::UniquePtr<char> health_check_service_name_;
|
291
292
|
RefCountedPtr<ServiceConfig> saved_service_config_;
|
292
293
|
bool received_first_resolver_result_ = false;
|
293
294
|
// The number of SubchannelWrapper instances referencing a given Subchannel.
|
294
|
-
|
295
|
+
std::map<Subchannel*, int> subchannel_refcount_map_;
|
295
296
|
// The set of SubchannelWrappers that currently exist.
|
296
297
|
// No need to hold a ref, since the map is updated in the control-plane
|
297
298
|
// combiner when the SubchannelWrappers are created and destroyed.
|
298
|
-
|
299
|
+
std::set<SubchannelWrapper*> subchannel_wrappers_;
|
299
300
|
// Pending ConnectedSubchannel updates for each SubchannelWrapper.
|
300
301
|
// Updates are queued here in the control plane combiner and then applied
|
301
302
|
// in the data plane mutex when the picker is updated.
|
302
|
-
|
303
|
-
|
303
|
+
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
|
304
|
+
RefCountedPtrLess<SubchannelWrapper>>
|
304
305
|
pending_subchannel_updates_;
|
305
306
|
|
306
307
|
//
|
@@ -313,15 +314,15 @@ class ChannelData {
|
|
313
314
|
// synchronously via get_channel_info().
|
314
315
|
//
|
315
316
|
gpr_mu info_mu_;
|
316
|
-
UniquePtr<char> info_lb_policy_name_;
|
317
|
-
UniquePtr<char> info_service_config_json_;
|
317
|
+
grpc_core::UniquePtr<char> info_lb_policy_name_;
|
318
|
+
grpc_core::UniquePtr<char> info_service_config_json_;
|
318
319
|
|
319
320
|
//
|
320
321
|
// Fields guarded by a mutex, since they need to be accessed
|
321
322
|
// synchronously via grpc_channel_num_external_connectivity_watchers().
|
322
323
|
//
|
323
324
|
mutable Mutex external_watchers_mu_;
|
324
|
-
|
325
|
+
std::map<grpc_closure*, ExternalConnectivityWatcher*> external_watchers_;
|
325
326
|
};
|
326
327
|
|
327
328
|
//
|
@@ -403,8 +404,9 @@ class CallData {
|
|
403
404
|
intptr_t handle) const override {
|
404
405
|
grpc_linked_mdelem* linked_mdelem =
|
405
406
|
reinterpret_cast<grpc_linked_mdelem*>(handle);
|
406
|
-
return std::make_pair(
|
407
|
-
|
407
|
+
return std::make_pair(
|
408
|
+
StringViewFromSlice(GRPC_MDKEY(linked_mdelem->md)),
|
409
|
+
StringViewFromSlice(GRPC_MDVALUE(linked_mdelem->md)));
|
408
410
|
}
|
409
411
|
|
410
412
|
CallData* calld_;
|
@@ -584,10 +586,10 @@ class CallData {
|
|
584
586
|
// A predicate type and some useful implementations for PendingBatchesFail().
|
585
587
|
typedef bool (*YieldCallCombinerPredicate)(
|
586
588
|
const CallCombinerClosureList& closures);
|
587
|
-
static bool YieldCallCombiner(const CallCombinerClosureList& closures) {
|
589
|
+
static bool YieldCallCombiner(const CallCombinerClosureList& /*closures*/) {
|
588
590
|
return true;
|
589
591
|
}
|
590
|
-
static bool NoYieldCallCombiner(const CallCombinerClosureList& closures) {
|
592
|
+
static bool NoYieldCallCombiner(const CallCombinerClosureList& /*closures*/) {
|
591
593
|
return false;
|
592
594
|
}
|
593
595
|
static bool YieldCallCombinerIfPendingBatchesFound(
|
@@ -633,8 +635,8 @@ class CallData {
|
|
633
635
|
|
634
636
|
// Sets *status and *server_pushback_md based on md_batch and error.
|
635
637
|
// Only sets *server_pushback_md if server_pushback_md != nullptr.
|
636
|
-
void GetCallStatus(
|
637
|
-
|
638
|
+
void GetCallStatus(grpc_metadata_batch* md_batch, grpc_error* error,
|
639
|
+
grpc_status_code* status,
|
638
640
|
grpc_mdelem** server_pushback_md);
|
639
641
|
// Adds recv_trailing_metadata_ready closure to closures.
|
640
642
|
void AddClosureForRecvTrailingMetadataReady(
|
@@ -663,10 +665,10 @@ class CallData {
|
|
663
665
|
|
664
666
|
// Adds the on_complete closure for the pending batch completed in
|
665
667
|
// batch_data to closures.
|
666
|
-
void AddClosuresForCompletedPendingBatch(
|
667
|
-
|
668
|
-
|
669
|
-
|
668
|
+
void AddClosuresForCompletedPendingBatch(grpc_call_element* elem,
|
669
|
+
SubchannelCallBatchData* batch_data,
|
670
|
+
grpc_error* error,
|
671
|
+
CallCombinerClosureList* closures);
|
670
672
|
|
671
673
|
// If there are any cached ops to replay or pending ops to start on the
|
672
674
|
// subchannel call, adds a closure to closures to invoke
|
@@ -841,7 +843,7 @@ class CallData {
|
|
841
843
|
class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
842
844
|
public:
|
843
845
|
SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
|
844
|
-
UniquePtr<char> health_check_service_name)
|
846
|
+
grpc_core::UniquePtr<char> health_check_service_name)
|
845
847
|
: SubchannelInterface(&grpc_client_channel_routing_trace),
|
846
848
|
chand_(chand),
|
847
849
|
subchannel_(subchannel),
|
@@ -896,15 +898,16 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
896
898
|
|
897
899
|
void WatchConnectivityState(
|
898
900
|
grpc_connectivity_state initial_state,
|
899
|
-
|
901
|
+
std::unique_ptr<ConnectivityStateWatcherInterface> watcher) override {
|
900
902
|
auto& watcher_wrapper = watcher_map_[watcher.get()];
|
901
903
|
GPR_ASSERT(watcher_wrapper == nullptr);
|
902
|
-
watcher_wrapper =
|
903
|
-
|
904
|
-
|
904
|
+
watcher_wrapper = new WatcherWrapper(std::move(watcher),
|
905
|
+
Ref(DEBUG_LOCATION, "WatcherWrapper"),
|
906
|
+
initial_state);
|
905
907
|
subchannel_->WatchConnectivityState(
|
906
908
|
initial_state,
|
907
|
-
UniquePtr<char>(
|
909
|
+
grpc_core::UniquePtr<char>(
|
910
|
+
gpr_strdup(health_check_service_name_.get())),
|
908
911
|
OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
|
909
912
|
watcher_wrapper));
|
910
913
|
}
|
@@ -926,7 +929,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
926
929
|
return subchannel_->channel_args();
|
927
930
|
}
|
928
931
|
|
929
|
-
void UpdateHealthCheckServiceName(
|
932
|
+
void UpdateHealthCheckServiceName(
|
933
|
+
grpc_core::UniquePtr<char> health_check_service_name) {
|
930
934
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
931
935
|
gpr_log(GPR_INFO,
|
932
936
|
"chand=%p: subchannel wrapper %p: updating health check service "
|
@@ -952,7 +956,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
952
956
|
watcher_wrapper = replacement;
|
953
957
|
subchannel_->WatchConnectivityState(
|
954
958
|
replacement->last_seen_state(),
|
955
|
-
UniquePtr<char>(
|
959
|
+
grpc_core::UniquePtr<char>(
|
960
|
+
gpr_strdup(health_check_service_name.get())),
|
956
961
|
OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
|
957
962
|
replacement));
|
958
963
|
}
|
@@ -992,7 +997,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
992
997
|
class WatcherWrapper : public Subchannel::ConnectivityStateWatcherInterface {
|
993
998
|
public:
|
994
999
|
WatcherWrapper(
|
995
|
-
|
1000
|
+
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
|
996
1001
|
watcher,
|
997
1002
|
RefCountedPtr<SubchannelWrapper> parent,
|
998
1003
|
grpc_connectivity_state initial_state)
|
@@ -1016,7 +1021,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1016
1021
|
connected_subchannel.get(), ConnectivityStateName(new_state));
|
1017
1022
|
}
|
1018
1023
|
// Will delete itself.
|
1019
|
-
|
1024
|
+
new Updater(Ref(), new_state, std::move(connected_subchannel));
|
1020
1025
|
}
|
1021
1026
|
|
1022
1027
|
grpc_pollset_set* interested_parties() override {
|
@@ -1028,7 +1033,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1028
1033
|
|
1029
1034
|
WatcherWrapper* MakeReplacement() {
|
1030
1035
|
auto* replacement =
|
1031
|
-
|
1036
|
+
new WatcherWrapper(std::move(watcher_), parent_, last_seen_state_);
|
1032
1037
|
replacement_ = replacement;
|
1033
1038
|
return replacement;
|
1034
1039
|
}
|
@@ -1052,7 +1057,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1052
1057
|
|
1053
1058
|
private:
|
1054
1059
|
static void ApplyUpdateInControlPlaneCombiner(void* arg,
|
1055
|
-
grpc_error* error) {
|
1060
|
+
grpc_error* /*error*/) {
|
1056
1061
|
Updater* self = static_cast<Updater*>(arg);
|
1057
1062
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1058
1063
|
gpr_log(GPR_INFO,
|
@@ -1072,7 +1077,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1072
1077
|
self->parent_->parent_->MaybeUpdateConnectedSubchannel(
|
1073
1078
|
std::move(self->connected_subchannel_));
|
1074
1079
|
self->parent_->watcher_->OnConnectivityStateChange(self->state_);
|
1075
|
-
|
1080
|
+
delete self;
|
1076
1081
|
}
|
1077
1082
|
|
1078
1083
|
RefCountedPtr<WatcherWrapper> parent_;
|
@@ -1081,7 +1086,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1081
1086
|
grpc_closure closure_;
|
1082
1087
|
};
|
1083
1088
|
|
1084
|
-
|
1089
|
+
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
|
1090
|
+
watcher_;
|
1085
1091
|
RefCountedPtr<SubchannelWrapper> parent_;
|
1086
1092
|
grpc_connectivity_state last_seen_state_;
|
1087
1093
|
WatcherWrapper* replacement_ = nullptr;
|
@@ -1110,13 +1116,13 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1110
1116
|
|
1111
1117
|
ChannelData* chand_;
|
1112
1118
|
Subchannel* subchannel_;
|
1113
|
-
UniquePtr<char> health_check_service_name_;
|
1119
|
+
grpc_core::UniquePtr<char> health_check_service_name_;
|
1114
1120
|
// Maps from the address of the watcher passed to us by the LB policy
|
1115
1121
|
// to the address of the WrapperWatcher that we passed to the underlying
|
1116
1122
|
// subchannel. This is needed so that when the LB policy calls
|
1117
1123
|
// CancelConnectivityStateWatch() with its watcher, we know the
|
1118
1124
|
// corresponding WrapperWatcher to cancel on the underlying subchannel.
|
1119
|
-
|
1125
|
+
std::map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
|
1120
1126
|
// To be accessed only in the control plane combiner.
|
1121
1127
|
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
1122
1128
|
// To be accessed only in the data plane mutex.
|
@@ -1163,7 +1169,7 @@ void ChannelData::ExternalConnectivityWatcher::Notify(
|
|
1163
1169
|
chand_->RemoveExternalConnectivityWatcher(on_complete_, /*cancel=*/false);
|
1164
1170
|
// Report new state to the user.
|
1165
1171
|
*state_ = state;
|
1166
|
-
|
1172
|
+
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_NONE);
|
1167
1173
|
// Hop back into the combiner to clean up.
|
1168
1174
|
// Not needed in state SHUTDOWN, because the tracker will
|
1169
1175
|
// automatically remove all watchers in that case.
|
@@ -1180,7 +1186,7 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
|
|
1180
1186
|
MemoryOrder::RELAXED)) {
|
1181
1187
|
return; // Already done.
|
1182
1188
|
}
|
1183
|
-
|
1189
|
+
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_CANCELLED);
|
1184
1190
|
// Hop back into the combiner to clean up.
|
1185
1191
|
chand_->combiner_->Run(
|
1186
1192
|
GRPC_CLOSURE_INIT(&remove_closure_, RemoveWatcherLocked, this, nullptr),
|
@@ -1188,12 +1194,10 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
|
|
1188
1194
|
}
|
1189
1195
|
|
1190
1196
|
void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked(
|
1191
|
-
void* arg, grpc_error* ignored) {
|
1197
|
+
void* arg, grpc_error* /*ignored*/) {
|
1192
1198
|
ExternalConnectivityWatcher* self =
|
1193
1199
|
static_cast<ExternalConnectivityWatcher*>(arg);
|
1194
|
-
|
1195
|
-
// and that GRPC_CLOSURE_RUN() will run the closure immediately.
|
1196
|
-
GRPC_CLOSURE_RUN(self->watcher_timer_init_, GRPC_ERROR_NONE);
|
1200
|
+
Closure::Run(DEBUG_LOCATION, self->watcher_timer_init_, GRPC_ERROR_NONE);
|
1197
1201
|
// Add new watcher.
|
1198
1202
|
self->chand_->state_tracker_.AddWatcher(
|
1199
1203
|
self->initial_state_,
|
@@ -1201,7 +1205,7 @@ void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked(
|
|
1201
1205
|
}
|
1202
1206
|
|
1203
1207
|
void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked(
|
1204
|
-
void* arg, grpc_error* ignored) {
|
1208
|
+
void* arg, grpc_error* /*ignored*/) {
|
1205
1209
|
ExternalConnectivityWatcher* self =
|
1206
1210
|
static_cast<ExternalConnectivityWatcher*>(arg);
|
1207
1211
|
self->chand_->state_tracker_.RemoveWatcher(self);
|
@@ -1228,14 +1232,14 @@ class ChannelData::ConnectivityWatcherAdder {
|
|
1228
1232
|
}
|
1229
1233
|
|
1230
1234
|
private:
|
1231
|
-
static void AddWatcherLocked(void* arg, grpc_error* error) {
|
1235
|
+
static void AddWatcherLocked(void* arg, grpc_error* /*error*/) {
|
1232
1236
|
ConnectivityWatcherAdder* self =
|
1233
1237
|
static_cast<ConnectivityWatcherAdder*>(arg);
|
1234
1238
|
self->chand_->state_tracker_.AddWatcher(self->initial_state_,
|
1235
1239
|
std::move(self->watcher_));
|
1236
1240
|
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
|
1237
1241
|
"ConnectivityWatcherAdder");
|
1238
|
-
|
1242
|
+
delete self;
|
1239
1243
|
}
|
1240
1244
|
|
1241
1245
|
ChannelData* chand_;
|
@@ -1262,13 +1266,13 @@ class ChannelData::ConnectivityWatcherRemover {
|
|
1262
1266
|
}
|
1263
1267
|
|
1264
1268
|
private:
|
1265
|
-
static void RemoveWatcherLocked(void* arg, grpc_error* error) {
|
1269
|
+
static void RemoveWatcherLocked(void* arg, grpc_error* /*error*/) {
|
1266
1270
|
ConnectivityWatcherRemover* self =
|
1267
1271
|
static_cast<ConnectivityWatcherRemover*>(arg);
|
1268
1272
|
self->chand_->state_tracker_.RemoveWatcher(self->watcher_);
|
1269
1273
|
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
|
1270
1274
|
"ConnectivityWatcherRemover");
|
1271
|
-
|
1275
|
+
delete self;
|
1272
1276
|
}
|
1273
1277
|
|
1274
1278
|
ChannelData* chand_;
|
@@ -1296,7 +1300,7 @@ class ChannelData::ClientChannelControlHelper
|
|
1296
1300
|
const grpc_channel_args& args) override {
|
1297
1301
|
bool inhibit_health_checking = grpc_channel_arg_get_bool(
|
1298
1302
|
grpc_channel_args_find(&args, GRPC_ARG_INHIBIT_HEALTH_CHECKING), false);
|
1299
|
-
UniquePtr<char> health_check_service_name;
|
1303
|
+
grpc_core::UniquePtr<char> health_check_service_name;
|
1300
1304
|
if (!inhibit_health_checking) {
|
1301
1305
|
health_check_service_name.reset(
|
1302
1306
|
gpr_strdup(chand_->health_check_service_name_.get()));
|
@@ -1319,7 +1323,7 @@ class ChannelData::ClientChannelControlHelper
|
|
1319
1323
|
|
1320
1324
|
void UpdateState(
|
1321
1325
|
grpc_connectivity_state state,
|
1322
|
-
|
1326
|
+
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) override {
|
1323
1327
|
grpc_error* disconnect_error = chand_->disconnect_error();
|
1324
1328
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1325
1329
|
const char* extra = disconnect_error == GRPC_ERROR_NONE
|
@@ -1461,8 +1465,8 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
|
|
1461
1465
|
grpc_uri_destroy(uri);
|
1462
1466
|
char* proxy_name = nullptr;
|
1463
1467
|
grpc_channel_args* new_args = nullptr;
|
1464
|
-
|
1465
|
-
|
1468
|
+
ProxyMapperRegistry::MapName(server_uri, args->channel_args, &proxy_name,
|
1469
|
+
&new_args);
|
1466
1470
|
target_uri_.reset(proxy_name != nullptr ? proxy_name
|
1467
1471
|
: gpr_strdup(server_uri));
|
1468
1472
|
channel_args_ = new_args != nullptr
|
@@ -1492,7 +1496,7 @@ ChannelData::~ChannelData() {
|
|
1492
1496
|
|
1493
1497
|
void ChannelData::UpdateStateAndPickerLocked(
|
1494
1498
|
grpc_connectivity_state state, const char* reason,
|
1495
|
-
|
1499
|
+
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) {
|
1496
1500
|
// Clean the control plane when entering IDLE.
|
1497
1501
|
if (picker_ == nullptr) {
|
1498
1502
|
health_check_service_name_.reset();
|
@@ -1592,8 +1596,8 @@ void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
|
|
1592
1596
|
lb_args.combiner = combiner_;
|
1593
1597
|
lb_args.channel_control_helper = MakeUnique<ClientChannelControlHelper>(this);
|
1594
1598
|
lb_args.args = channel_args_;
|
1595
|
-
UniquePtr<char> target_uri(gpr_strdup(target_uri_.get()));
|
1596
|
-
resolving_lb_policy_.reset(
|
1599
|
+
grpc_core::UniquePtr<char> target_uri(gpr_strdup(target_uri_.get()));
|
1600
|
+
resolving_lb_policy_.reset(new ResolvingLoadBalancingPolicy(
|
1597
1601
|
std::move(lb_args), &grpc_client_channel_routing_trace,
|
1598
1602
|
std::move(target_uri), ProcessResolverResultLocked, this));
|
1599
1603
|
grpc_pollset_set_add_pollset_set(resolving_lb_policy_->interested_parties(),
|
@@ -1615,7 +1619,7 @@ void ChannelData::DestroyResolvingLoadBalancingPolicyLocked() {
|
|
1615
1619
|
void ChannelData::ProcessLbPolicy(
|
1616
1620
|
const Resolver::Result& resolver_result,
|
1617
1621
|
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
1618
|
-
UniquePtr<char>* lb_policy_name,
|
1622
|
+
grpc_core::UniquePtr<char>* lb_policy_name,
|
1619
1623
|
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config) {
|
1620
1624
|
// Prefer the LB policy name found in the service config.
|
1621
1625
|
if (parsed_service_config != nullptr &&
|
@@ -1710,7 +1714,7 @@ bool ChannelData::ProcessResolverResultLocked(
|
|
1710
1714
|
return false;
|
1711
1715
|
}
|
1712
1716
|
// Process service config.
|
1713
|
-
UniquePtr<char> service_config_json;
|
1717
|
+
grpc_core::UniquePtr<char> service_config_json;
|
1714
1718
|
const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
|
1715
1719
|
nullptr;
|
1716
1720
|
if (service_config != nullptr) {
|
@@ -1745,7 +1749,8 @@ bool ChannelData::ProcessResolverResultLocked(
|
|
1745
1749
|
// Update health check service name used by existing subchannel wrappers.
|
1746
1750
|
for (auto* subchannel_wrapper : chand->subchannel_wrappers_) {
|
1747
1751
|
subchannel_wrapper->UpdateHealthCheckServiceName(
|
1748
|
-
UniquePtr<char>(
|
1752
|
+
grpc_core::UniquePtr<char>(
|
1753
|
+
gpr_strdup(chand->health_check_service_name_.get())));
|
1749
1754
|
}
|
1750
1755
|
// Save service config.
|
1751
1756
|
chand->saved_service_config_ = std::move(service_config);
|
@@ -1770,7 +1775,7 @@ bool ChannelData::ProcessResolverResultLocked(
|
|
1770
1775
|
chand->UpdateServiceConfigLocked(std::move(retry_throttle_data),
|
1771
1776
|
chand->saved_service_config_);
|
1772
1777
|
}
|
1773
|
-
UniquePtr<char> processed_lb_policy_name;
|
1778
|
+
grpc_core::UniquePtr<char> processed_lb_policy_name;
|
1774
1779
|
chand->ProcessLbPolicy(result, parsed_service_config,
|
1775
1780
|
&processed_lb_policy_name, lb_policy_config);
|
1776
1781
|
// Swap out the data used by GetChannelInfo().
|
@@ -1809,7 +1814,7 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
|
|
1809
1814
|
return result.error;
|
1810
1815
|
}
|
1811
1816
|
|
1812
|
-
void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) {
|
1817
|
+
void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
|
1813
1818
|
grpc_transport_op* op = static_cast<grpc_transport_op*>(arg);
|
1814
1819
|
grpc_channel_element* elem =
|
1815
1820
|
static_cast<grpc_channel_element*>(op->handler_private.extra_arg);
|
@@ -1826,8 +1831,9 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) {
|
|
1826
1831
|
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
|
1827
1832
|
grpc_error* error = chand->DoPingLocked(op);
|
1828
1833
|
if (error != GRPC_ERROR_NONE) {
|
1829
|
-
|
1830
|
-
|
1834
|
+
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
|
1835
|
+
GRPC_ERROR_REF(error));
|
1836
|
+
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_ack, error);
|
1831
1837
|
}
|
1832
1838
|
op->bind_pollset = nullptr;
|
1833
1839
|
op->send_ping.on_initiate = nullptr;
|
@@ -1869,7 +1875,7 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) {
|
|
1869
1875
|
}
|
1870
1876
|
}
|
1871
1877
|
GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op");
|
1872
|
-
|
1878
|
+
ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE);
|
1873
1879
|
}
|
1874
1880
|
|
1875
1881
|
void ChannelData::StartTransportOp(grpc_channel_element* elem,
|
@@ -1937,7 +1943,7 @@ ChannelData::GetConnectedSubchannelInDataPlane(
|
|
1937
1943
|
return connected_subchannel->Ref();
|
1938
1944
|
}
|
1939
1945
|
|
1940
|
-
void ChannelData::TryToConnectLocked(void* arg, grpc_error* error_ignored) {
|
1946
|
+
void ChannelData::TryToConnectLocked(void* arg, grpc_error* /*error_ignored*/) {
|
1941
1947
|
auto* chand = static_cast<ChannelData*>(arg);
|
1942
1948
|
if (chand->resolving_lb_policy_ != nullptr) {
|
1943
1949
|
chand->resolving_lb_policy_->ExitIdleLocked();
|
@@ -1961,12 +1967,12 @@ grpc_connectivity_state ChannelData::CheckConnectivityState(
|
|
1961
1967
|
void ChannelData::AddConnectivityWatcher(
|
1962
1968
|
grpc_connectivity_state initial_state,
|
1963
1969
|
OrphanablePtr<AsyncConnectivityStateWatcherInterface> watcher) {
|
1964
|
-
|
1970
|
+
new ConnectivityWatcherAdder(this, initial_state, std::move(watcher));
|
1965
1971
|
}
|
1966
1972
|
|
1967
1973
|
void ChannelData::RemoveConnectivityWatcher(
|
1968
1974
|
AsyncConnectivityStateWatcherInterface* watcher) {
|
1969
|
-
|
1975
|
+
new ConnectivityWatcherRemover(this, watcher);
|
1970
1976
|
}
|
1971
1977
|
|
1972
1978
|
//
|
@@ -2050,7 +2056,7 @@ grpc_error* CallData::Init(grpc_call_element* elem,
|
|
2050
2056
|
}
|
2051
2057
|
|
2052
2058
|
void CallData::Destroy(grpc_call_element* elem,
|
2053
|
-
const grpc_call_final_info* final_info
|
2059
|
+
const grpc_call_final_info* /*final_info*/,
|
2054
2060
|
grpc_closure* then_schedule_closure) {
|
2055
2061
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
2056
2062
|
if (GPR_LIKELY(calld->subchannel_call_ != nullptr)) {
|
@@ -2058,7 +2064,8 @@ void CallData::Destroy(grpc_call_element* elem,
|
|
2058
2064
|
then_schedule_closure = nullptr;
|
2059
2065
|
}
|
2060
2066
|
calld->~CallData();
|
2061
|
-
|
2067
|
+
// TODO(yashkt) : This can potentially be a Closure::Run
|
2068
|
+
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
|
2062
2069
|
}
|
2063
2070
|
|
2064
2071
|
void CallData::StartTransportStreamOpBatch(
|
@@ -2263,8 +2270,8 @@ void CallData::RecvTrailingMetadataReadyForLoadBalancingPolicy(
|
|
2263
2270
|
calld->lb_recv_trailing_metadata_ready_(error, &trailing_metadata,
|
2264
2271
|
&calld->lb_call_state_);
|
2265
2272
|
// Chain to original callback.
|
2266
|
-
|
2267
|
-
|
2273
|
+
Closure::Run(DEBUG_LOCATION, calld->original_recv_trailing_metadata_ready_,
|
2274
|
+
GRPC_ERROR_REF(error));
|
2268
2275
|
}
|
2269
2276
|
|
2270
2277
|
void CallData::MaybeInjectRecvTrailingMetadataReadyForLoadBalancingPolicy(
|
@@ -2445,7 +2452,7 @@ void CallData::PendingBatchesFail(
|
|
2445
2452
|
|
2446
2453
|
// This is called via the call combiner, so access to calld is synchronized.
|
2447
2454
|
void CallData::ResumePendingBatchInCallCombiner(void* arg,
|
2448
|
-
grpc_error* ignored) {
|
2455
|
+
grpc_error* /*ignored*/) {
|
2449
2456
|
grpc_transport_stream_op_batch* batch =
|
2450
2457
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
2451
2458
|
SubchannelCall* subchannel_call =
|
@@ -2759,7 +2766,8 @@ void CallData::InvokeRecvInitialMetadataCallback(void* arg, grpc_error* error) {
|
|
2759
2766
|
calld->MaybeClearPendingBatch(batch_data->elem, pending);
|
2760
2767
|
batch_data->Unref();
|
2761
2768
|
// Invoke callback.
|
2762
|
-
|
2769
|
+
Closure::Run(DEBUG_LOCATION, recv_initial_metadata_ready,
|
2770
|
+
GRPC_ERROR_REF(error));
|
2763
2771
|
}
|
2764
2772
|
|
2765
2773
|
void CallData::RecvInitialMetadataReady(void* arg, grpc_error* error) {
|
@@ -2849,7 +2857,7 @@ void CallData::InvokeRecvMessageCallback(void* arg, grpc_error* error) {
|
|
2849
2857
|
calld->MaybeClearPendingBatch(batch_data->elem, pending);
|
2850
2858
|
batch_data->Unref();
|
2851
2859
|
// Invoke callback.
|
2852
|
-
|
2860
|
+
Closure::Run(DEBUG_LOCATION, recv_message_ready, GRPC_ERROR_REF(error));
|
2853
2861
|
}
|
2854
2862
|
|
2855
2863
|
void CallData::RecvMessageReady(void* arg, grpc_error* error) {
|
@@ -2908,8 +2916,7 @@ void CallData::RecvMessageReady(void* arg, grpc_error* error) {
|
|
2908
2916
|
// recv_trailing_metadata handling
|
2909
2917
|
//
|
2910
2918
|
|
2911
|
-
void CallData::GetCallStatus(
|
2912
|
-
grpc_metadata_batch* md_batch, grpc_error* error,
|
2919
|
+
void CallData::GetCallStatus(grpc_metadata_batch* md_batch, grpc_error* error,
|
2913
2920
|
grpc_status_code* status,
|
2914
2921
|
grpc_mdelem** server_pushback_md) {
|
2915
2922
|
if (error != GRPC_ERROR_NONE) {
|
@@ -3078,7 +3085,7 @@ void CallData::RecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
|
3078
3085
|
grpc_mdelem* server_pushback_md = nullptr;
|
3079
3086
|
grpc_metadata_batch* md_batch =
|
3080
3087
|
batch_data->batch.payload->recv_trailing_metadata.recv_trailing_metadata;
|
3081
|
-
calld->GetCallStatus(
|
3088
|
+
calld->GetCallStatus(md_batch, GRPC_ERROR_REF(error), &status,
|
3082
3089
|
&server_pushback_md);
|
3083
3090
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
3084
3091
|
gpr_log(GPR_INFO, "chand=%p calld=%p: call finished, status=%s", chand,
|
@@ -3111,8 +3118,7 @@ void CallData::RecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
|
3111
3118
|
|
3112
3119
|
void CallData::AddClosuresForCompletedPendingBatch(
|
3113
3120
|
grpc_call_element* elem, SubchannelCallBatchData* batch_data,
|
3114
|
-
|
3115
|
-
CallCombinerClosureList* closures) {
|
3121
|
+
grpc_error* error, CallCombinerClosureList* closures) {
|
3116
3122
|
PendingBatch* pending = PendingBatchFind(
|
3117
3123
|
elem, "completed", [batch_data](grpc_transport_stream_op_batch* batch) {
|
3118
3124
|
// Match the pending batch with the same set of send ops as the
|
@@ -3210,7 +3216,7 @@ void CallData::OnComplete(void* arg, grpc_error* error) {
|
|
3210
3216
|
if (!retry_state->retry_dispatched) {
|
3211
3217
|
// Add closure for the completed pending batch, if any.
|
3212
3218
|
calld->AddClosuresForCompletedPendingBatch(
|
3213
|
-
elem, batch_data,
|
3219
|
+
elem, batch_data, GRPC_ERROR_REF(error), &closures);
|
3214
3220
|
// If needed, add a callback to start any replay or pending send ops on
|
3215
3221
|
// the subchannel call.
|
3216
3222
|
if (!retry_state->completed_recv_trailing_metadata) {
|
@@ -3238,7 +3244,7 @@ void CallData::OnComplete(void* arg, grpc_error* error) {
|
|
3238
3244
|
// subchannel batch construction
|
3239
3245
|
//
|
3240
3246
|
|
3241
|
-
void CallData::StartBatchInCallCombiner(void* arg, grpc_error* ignored) {
|
3247
|
+
void CallData::StartBatchInCallCombiner(void* arg, grpc_error* /*ignored*/) {
|
3242
3248
|
grpc_transport_stream_op_batch* batch =
|
3243
3249
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
3244
3250
|
SubchannelCall* subchannel_call =
|
@@ -3608,7 +3614,8 @@ void CallData::AddSubchannelBatchesForPendingBatches(
|
|
3608
3614
|
}
|
3609
3615
|
}
|
3610
3616
|
|
3611
|
-
void CallData::StartRetriableSubchannelBatches(void* arg,
|
3617
|
+
void CallData::StartRetriableSubchannelBatches(void* arg,
|
3618
|
+
grpc_error* /*ignored*/) {
|
3612
3619
|
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
3613
3620
|
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
3614
3621
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
@@ -3680,7 +3687,7 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) {
|
|
3680
3687
|
|
3681
3688
|
void CallData::AsyncPickDone(grpc_call_element* elem, grpc_error* error) {
|
3682
3689
|
GRPC_CLOSURE_INIT(&pick_closure_, PickDone, elem, grpc_schedule_on_exec_ctx);
|
3683
|
-
|
3690
|
+
ExecCtx::Run(DEBUG_LOCATION, &pick_closure_, error);
|
3684
3691
|
}
|
3685
3692
|
|
3686
3693
|
void CallData::PickDone(void* arg, grpc_error* error) {
|
@@ -3732,7 +3739,7 @@ class CallData::QueuedPickCanceller {
|
|
3732
3739
|
YieldCallCombinerIfPendingBatchesFound);
|
3733
3740
|
}
|
3734
3741
|
GRPC_CALL_STACK_UNREF(calld->owning_call_, "QueuedPickCanceller");
|
3735
|
-
|
3742
|
+
delete self;
|
3736
3743
|
}
|
3737
3744
|
|
3738
3745
|
grpc_call_element* elem_;
|
@@ -3761,7 +3768,7 @@ void CallData::AddCallToQueuedPicksLocked(grpc_call_element* elem) {
|
|
3761
3768
|
pick_.elem = elem;
|
3762
3769
|
chand->AddQueuedPick(&pick_, pollent_);
|
3763
3770
|
// Register call combiner cancellation callback.
|
3764
|
-
pick_canceller_ =
|
3771
|
+
pick_canceller_ = new QueuedPickCanceller(elem);
|
3765
3772
|
}
|
3766
3773
|
|
3767
3774
|
void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
|