grpc 1.28.0 → 1.30.2
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 +7694 -11190
- data/include/grpc/grpc.h +2 -2
- data/include/grpc/grpc_security.h +30 -9
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/grpc_types.h +19 -21
- data/include/grpc/impl/codegen/port_platform.h +6 -2
- data/include/grpc/module.modulemap +24 -39
- data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +212 -241
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -22
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +17 -10
- data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
- data/src/core/ext/filters/client_channel/lb_policy.h +42 -33
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +240 -301
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -11
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -2
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
- data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
- data/src/core/ext/filters/client_channel/resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/resolver.h +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +73 -59
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +16 -20
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +184 -133
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +40 -43
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +32 -5
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
- data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +16 -16
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +20 -31
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +4 -3
- data/src/core/ext/filters/client_channel/server_address.cc +6 -9
- data/src/core/ext/filters/client_channel/server_address.h +6 -12
- data/src/core/ext/filters/client_channel/service_config.cc +104 -144
- data/src/core/ext/filters/client_channel/service_config.h +28 -98
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +54 -24
- data/src/core/ext/filters/client_channel/subchannel.h +35 -11
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +348 -221
- data/src/core/ext/filters/client_channel/xds/xds_api.h +37 -37
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +44 -49
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +532 -339
- data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +31 -19
- data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
- data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +7 -10
- data/src/core/ext/filters/message_size/message_size_filter.h +4 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +23 -22
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +14 -21
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +15 -8
- data/src/core/ext/transport/inproc/inproc_transport.cc +19 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -875
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +21 -8
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +43 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +47 -26
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +115 -65
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -13
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +88 -6
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +12 -4
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +16 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +63 -41
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +173 -77
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +90 -30
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
- data/src/core/ext/upb-generated/validate/validate.upb.h +69 -63
- data/src/core/lib/channel/channel_args.cc +15 -14
- data/src/core/lib/channel/channel_args.h +3 -1
- data/src/core/lib/channel/channel_stack.h +20 -13
- data/src/core/lib/channel/channelz.cc +5 -6
- data/src/core/lib/channel/channelz.h +3 -2
- data/src/core/lib/channel/channelz_registry.cc +5 -3
- data/src/core/lib/channel/connected_channel.cc +7 -5
- data/src/core/lib/channel/context.h +1 -1
- data/src/core/lib/channel/handshaker.cc +11 -13
- data/src/core/lib/channel/handshaker.h +4 -2
- data/src/core/lib/channel/handshaker_registry.cc +5 -17
- data/src/core/lib/channel/status_util.cc +2 -3
- data/src/core/lib/compression/message_compress.cc +5 -1
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +3 -1
- data/src/core/lib/gpr/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +2 -26
- data/src/core/lib/gpr/string.h +0 -16
- data/src/core/lib/gpr/sync_abseil.cc +2 -0
- data/src/core/lib/gpr/time.cc +4 -0
- data/src/core/lib/gpr/time_posix.cc +1 -1
- data/src/core/lib/gprpp/atomic.h +6 -6
- data/src/core/lib/gprpp/fork.cc +1 -1
- data/src/core/lib/gprpp/host_port.cc +29 -35
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/map.h +5 -11
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +2 -3
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.h +22 -21
- data/src/core/lib/iomgr/call_combiner.h +3 -2
- data/src/core/lib/iomgr/cfstream_handle.cc +3 -2
- data/src/core/lib/iomgr/closure.h +2 -3
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/error.cc +6 -9
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +356 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -23
- data/src/core/lib/iomgr/ev_epollex_linux.cc +2 -3
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
- data/src/core/lib/iomgr/ev_posix.cc +2 -3
- data/src/core/lib/iomgr/exec_ctx.h +14 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
- data/src/core/lib/iomgr/port.h +1 -0
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.h +4 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +29 -39
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -17
- data/src/core/lib/iomgr/resource_quota.cc +4 -6
- data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
- data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -26
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
- data/src/core/lib/iomgr/tcp_client_posix.cc +8 -5
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
- data/src/core/lib/iomgr/tcp_custom.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
- data/src/core/lib/iomgr/tcp_uv.cc +3 -2
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer_generic.cc +2 -3
- data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/udp_server.cc +9 -14
- data/src/core/lib/json/json.h +3 -2
- data/src/core/lib/json/json_reader.cc +5 -5
- data/src/core/lib/json/json_writer.cc +13 -12
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
- data/src/core/lib/security/credentials/credentials.cc +0 -84
- data/src/core/lib/security/credentials/credentials.h +8 -59
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -8
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +55 -27
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +38 -11
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -7
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -25
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +59 -12
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -10
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +77 -51
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +14 -0
- data/src/core/lib/slice/slice_utils.h +9 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
- data/src/core/lib/surface/call.cc +2 -3
- data/src/core/lib/surface/call_log_batch.cc +50 -58
- data/src/core/lib/surface/channel.cc +53 -31
- data/src/core/lib/surface/channel.h +35 -4
- data/src/core/lib/surface/channel_ping.cc +2 -3
- data/src/core/lib/surface/completion_queue.cc +33 -33
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init_secure.cc +1 -4
- data/src/core/lib/surface/server.cc +570 -369
- data/src/core/lib/surface/server.h +32 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +7 -2
- data/src/core/lib/transport/connectivity_state.cc +7 -6
- data/src/core/lib/transport/connectivity_state.h +5 -3
- data/src/core/lib/transport/metadata.cc +3 -3
- data/src/core/lib/transport/metadata_batch.h +2 -3
- data/src/core/lib/transport/static_metadata.h +1 -1
- data/src/core/lib/transport/status_conversion.cc +6 -14
- data/src/core/lib/transport/transport.cc +2 -3
- data/src/core/lib/transport/transport.h +3 -2
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.h +2 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +8 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +32 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- data/src/core/tsi/fake_transport_security.cc +10 -15
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
- data/src/core/tsi/ssl_transport_security.cc +52 -39
- data/src/core/tsi/ssl_transport_security.h +8 -8
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.h +6 -9
- data/src/core/tsi/transport_security_grpc.h +2 -3
- data/src/core/tsi/transport_security_interface.h +3 -3
- data/src/ruby/ext/grpc/rb_call.c +9 -1
- data/src/ruby/ext/grpc/rb_call_credentials.c +3 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +7 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +7 -1
- data/src/ruby/spec/support/services.rb +10 -4
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
- data/third_party/abseil-cpp/absl/time/format.cc +153 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1584 -0
- data/third_party/boringssl-with-bazel/err_data.c +329 -297
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +14 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +432 -160
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -12
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +172 -77
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +5 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +14 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +28 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +12 -4
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +64 -47
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +64 -5
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +6 -2
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -27
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +50 -20
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
- metadata +115 -39
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
- data/src/core/lib/gprpp/string_view.h +0 -60
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
data/include/grpc/grpc.h
CHANGED
@@ -225,8 +225,8 @@ GRPCAPI void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq,
|
|
225
225
|
void* tag, void* reserved);
|
226
226
|
|
227
227
|
/** Pre-register a method/host pair on a channel.
|
228
|
-
method and host are not owned and must remain alive while the
|
229
|
-
|
228
|
+
method and host are not owned and must remain alive while the channel is
|
229
|
+
alive. */
|
230
230
|
GRPCAPI void* grpc_channel_register_call(grpc_channel* channel,
|
231
231
|
const char* method, const char* host,
|
232
232
|
void* reserved);
|
@@ -390,6 +390,14 @@ typedef struct {
|
|
390
390
|
void* reserved;
|
391
391
|
} grpc_auth_metadata_context;
|
392
392
|
|
393
|
+
/** Performs a deep copy from \a from to \a to. **/
|
394
|
+
GRPCAPI void grpc_auth_metadata_context_copy(grpc_auth_metadata_context* from,
|
395
|
+
grpc_auth_metadata_context* to);
|
396
|
+
|
397
|
+
/** Releases internal resources held by \a context. **/
|
398
|
+
GRPCAPI void grpc_auth_metadata_context_reset(
|
399
|
+
grpc_auth_metadata_context* context);
|
400
|
+
|
393
401
|
/** Maximum number of metadata entries returnable by a credentials plugin via
|
394
402
|
a synchronous return. */
|
395
403
|
#define GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX 4
|
@@ -425,6 +433,10 @@ typedef struct {
|
|
425
433
|
size_t* num_creds_md, grpc_status_code* status,
|
426
434
|
const char** error_details);
|
427
435
|
|
436
|
+
/** Implements debug string of the given plugin. This method returns an
|
437
|
+
* allocated string that the caller needs to free using gpr_free() */
|
438
|
+
char* (*debug_string)(void* state);
|
439
|
+
|
428
440
|
/** Destroys the plugin state. */
|
429
441
|
void (*destroy)(void* state);
|
430
442
|
|
@@ -710,6 +722,10 @@ GRPCAPI grpc_server_credentials* grpc_local_server_credentials_create(
|
|
710
722
|
/** --- TLS channel/server credentials ---
|
711
723
|
* It is used for experimental purpose for now and subject to change. */
|
712
724
|
|
725
|
+
/** Struct for indicating errors. It is used for
|
726
|
+
* experimental purpose for now and subject to change. */
|
727
|
+
typedef struct grpc_tls_error_details grpc_tls_error_details;
|
728
|
+
|
713
729
|
/** Config for TLS key materials. It is used for
|
714
730
|
* experimental purpose for now and subject to change. */
|
715
731
|
typedef struct grpc_tls_key_materials_config grpc_tls_key_materials_config;
|
@@ -789,11 +805,13 @@ GRPCAPI grpc_tls_key_materials_config* grpc_tls_key_materials_config_create(
|
|
789
805
|
void);
|
790
806
|
|
791
807
|
/** Set grpc_tls_key_materials_config instance with provided a TLS certificate.
|
792
|
-
config will take the ownership of pem_root_certs and pem_key_cert_pairs.
|
793
808
|
It's valid for the caller to provide nullptr pem_root_certs, in which case
|
794
809
|
the gRPC-provided root cert will be used. pem_key_cert_pairs should not be
|
795
|
-
NULL.
|
796
|
-
|
810
|
+
NULL.
|
811
|
+
The ownerships of |pem_root_certs| and |pem_key_cert_pairs| remain with the
|
812
|
+
caller.
|
813
|
+
It returns 1 on success and 0 on failure. It is used for experimental
|
814
|
+
purpose for now and subject to change.
|
797
815
|
*/
|
798
816
|
GRPCAPI int grpc_tls_key_materials_config_set_key_materials(
|
799
817
|
grpc_tls_key_materials_config* config, const char* pem_root_certs,
|
@@ -832,8 +850,10 @@ typedef void (*grpc_tls_on_credential_reload_done_cb)(
|
|
832
850
|
- cb and cb_user_data represent a gRPC-provided
|
833
851
|
callback and an argument passed to it.
|
834
852
|
- key_materials_config is an in/output parameter containing currently
|
835
|
-
used/newly reloaded credentials. If credential reload does not result
|
836
|
-
|
853
|
+
used/newly reloaded credentials. If credential reload does not result in
|
854
|
+
a new credential, key_materials_config should not be modified. The same
|
855
|
+
key_materials_config object can be updated if new key materials is
|
856
|
+
available.
|
837
857
|
- status and error_details are used to hold information about
|
838
858
|
errors occurred when a credential reload request is scheduled/cancelled.
|
839
859
|
- config is a pointer to the unique grpc_tls_credential_reload_config
|
@@ -849,7 +869,7 @@ struct grpc_tls_credential_reload_arg {
|
|
849
869
|
void* cb_user_data;
|
850
870
|
grpc_tls_key_materials_config* key_materials_config;
|
851
871
|
grpc_ssl_certificate_config_reload_status status;
|
852
|
-
|
872
|
+
grpc_tls_error_details* error_details;
|
853
873
|
grpc_tls_credential_reload_config* config;
|
854
874
|
void* context;
|
855
875
|
void (*destroy_context)(void* ctx);
|
@@ -861,8 +881,9 @@ struct grpc_tls_credential_reload_arg {
|
|
861
881
|
- schedule is a pointer to an application-provided callback used to invoke
|
862
882
|
credential reload API. The implementation of this method has to be
|
863
883
|
non-blocking, but can be performed synchronously or asynchronously.
|
864
|
-
1) If processing occurs synchronously, it populates
|
865
|
-
arg->status, and arg->error_details
|
884
|
+
1) If processing occurs synchronously, it populates
|
885
|
+
arg->key_materials_config, arg->status, and arg->error_details
|
886
|
+
and returns zero.
|
866
887
|
2) If processing occurs asynchronously, it returns a non-zero value.
|
867
888
|
The application then invokes arg->cb when processing is completed. Note
|
868
889
|
that arg->cb cannot be invoked before schedule API returns.
|
@@ -926,7 +947,7 @@ struct grpc_tls_server_authorization_check_arg {
|
|
926
947
|
const char* peer_cert;
|
927
948
|
const char* peer_cert_full_chain;
|
928
949
|
grpc_status_code status;
|
929
|
-
|
950
|
+
grpc_tls_error_details* error_details;
|
930
951
|
grpc_tls_server_authorization_check_config* config;
|
931
952
|
void* context;
|
932
953
|
void (*destroy_context)(void* ctx);
|
@@ -32,6 +32,7 @@ extern "C" {
|
|
32
32
|
#define GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME "x509_pem_cert_chain"
|
33
33
|
#define GRPC_SSL_SESSION_REUSED_PROPERTY "ssl_session_reused"
|
34
34
|
#define GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME "security_level"
|
35
|
+
#define GRPC_PEER_SPIFFE_ID_PROPERTY_NAME "peer_spiffe_id"
|
35
36
|
|
36
37
|
/** Environment variable that points to the default SSL roots file. This file
|
37
38
|
must be a PEM encoded file with all the roots such as the one that can be
|
@@ -174,6 +174,11 @@ typedef struct {
|
|
174
174
|
/** Enable/disable support for per-message compression. Defaults to 1, unless
|
175
175
|
GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
|
176
176
|
#define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression"
|
177
|
+
/** Experimental Arg. Enable/disable support for per-message decompression.
|
178
|
+
Defaults to 1. If disabled, decompression will not be performed and the
|
179
|
+
application will see the compressed message in the byte buffer. */
|
180
|
+
#define GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION \
|
181
|
+
"grpc.per_message_decompression"
|
177
182
|
/** Enable/disable support for deadline checking. Defaults to 1, unless
|
178
183
|
GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0 */
|
179
184
|
#define GRPC_ARG_ENABLE_DEADLINE_CHECKS "grpc.enable_deadline_checking"
|
@@ -198,18 +203,19 @@ typedef struct {
|
|
198
203
|
/** Should BDP probing be performed? */
|
199
204
|
#define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
|
200
205
|
/** Minimum time between sending successive ping frames without receiving any
|
201
|
-
data frame, Int valued, milliseconds. */
|
206
|
+
data/header/window_update frame, Int valued, milliseconds. */
|
202
207
|
#define GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS \
|
203
208
|
"grpc.http2.min_time_between_pings_ms"
|
204
209
|
/** Minimum allowed time between a server receiving successive ping frames
|
205
|
-
without sending any data frame. Int valued, milliseconds
|
210
|
+
without sending any data/header/window_update frame. Int valued, milliseconds
|
211
|
+
*/
|
206
212
|
#define GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS \
|
207
213
|
"grpc.http2.min_ping_interval_without_data_ms"
|
208
214
|
/** Channel arg to override the http2 :scheme header */
|
209
215
|
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
|
210
|
-
/** How many pings can we send before needing to send a
|
211
|
-
|
212
|
-
|
216
|
+
/** How many pings can we send before needing to send a
|
217
|
+
data/header/window_update frame? (0 indicates that an infinite number of
|
218
|
+
pings can be sent without sending a data frame or header frame) */
|
213
219
|
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
|
214
220
|
"grpc.http2.max_pings_without_data"
|
215
221
|
/** How many misbehaving pings the server can bear before sending goaway and
|
@@ -344,22 +350,11 @@ typedef struct {
|
|
344
350
|
balancer before using fallback backend addresses from the resolver.
|
345
351
|
If 0, enter fallback mode immediately. Default value is 10000. */
|
346
352
|
#define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
|
347
|
-
/* Timeout in milliseconds to wait for the
|
348
|
-
|
349
|
-
|
350
|
-
#define
|
351
|
-
|
352
|
-
from the received EDS update. If 0, delete the locality immediately. Default
|
353
|
-
value is 15 minutes. */
|
354
|
-
#define GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS \
|
355
|
-
"grpc.xds_locality_retention_interval_ms"
|
356
|
-
/* Timeout in milliseconds to wait for the localities of a specific priority to
|
357
|
-
complete their initial connection attempt before xDS fails over to the next
|
358
|
-
priority. Specifically, the connection attempt of a priority is considered
|
359
|
-
completed when any locality of that priority is ready or all the localities
|
360
|
-
of that priority fail to connect. If 0, failover happens immediately. Default
|
361
|
-
value is 10 seconds. */
|
362
|
-
#define GRPC_ARG_XDS_FAILOVER_TIMEOUT_MS "grpc.xds_failover_timeout_ms"
|
353
|
+
/* Timeout in milliseconds to wait for the child of a specific priority to
|
354
|
+
complete its initial connection attempt before the priority LB policy fails
|
355
|
+
over to the next priority. Default value is 10 seconds. */
|
356
|
+
#define GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS \
|
357
|
+
"grpc.priority_failover_timeout_ms"
|
363
358
|
/* Timeout in milliseconds to wait for a resource to be returned from
|
364
359
|
* the xds server before assuming that it does not exist.
|
365
360
|
* The default is 15 seconds. */
|
@@ -392,6 +387,9 @@ typedef struct {
|
|
392
387
|
"grpc.disable_client_authority_filter"
|
393
388
|
/** If set to zero, disables use of http proxies. Enabled by default. */
|
394
389
|
#define GRPC_ARG_ENABLE_HTTP_PROXY "grpc.enable_http_proxy"
|
390
|
+
/** Channel arg to set http proxy per channel. If set, the channel arg
|
391
|
+
* value will be prefered over the envrionment variable settings. */
|
392
|
+
#define GRPC_ARG_HTTP_PROXY "grpc.http_proxy"
|
395
393
|
/** If set to non zero, surfaces the user agent string to the server. User
|
396
394
|
agent is surfaced by default. */
|
397
395
|
#define GRPC_ARG_SURFACE_USER_AGENT "grpc.surface_user_agent"
|
@@ -53,6 +53,8 @@
|
|
53
53
|
#define NOMINMAX
|
54
54
|
#endif /* NOMINMAX */
|
55
55
|
|
56
|
+
#include <windows.h>
|
57
|
+
|
56
58
|
#ifndef _WIN32_WINNT
|
57
59
|
#error \
|
58
60
|
"Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
|
@@ -63,8 +65,6 @@
|
|
63
65
|
#endif /* _WIN32_WINNT < 0x0600 */
|
64
66
|
#endif /* defined(_WIN32_WINNT) */
|
65
67
|
|
66
|
-
#include <windows.h>
|
67
|
-
|
68
68
|
#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
|
69
69
|
#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
|
70
70
|
#undef WIN32_LEAN_AND_MEAN
|
@@ -666,18 +666,22 @@ typedef unsigned __int64 uint64_t;
|
|
666
666
|
#endif /* GPR_ATTRIBUTE_NO_TSAN (1) */
|
667
667
|
|
668
668
|
/* GRPC_TSAN_ENABLED will be defined, when compiled with thread sanitizer. */
|
669
|
+
#ifndef GRPC_TSAN_SUPPRESSED
|
669
670
|
#if defined(__SANITIZE_THREAD__)
|
670
671
|
#define GRPC_TSAN_ENABLED
|
671
672
|
#elif GPR_HAS_FEATURE(thread_sanitizer)
|
672
673
|
#define GRPC_TSAN_ENABLED
|
673
674
|
#endif
|
675
|
+
#endif
|
674
676
|
|
675
677
|
/* GRPC_ASAN_ENABLED will be defined, when compiled with address sanitizer. */
|
678
|
+
#ifndef GRPC_ASAN_SUPPRESSED
|
676
679
|
#if defined(__SANITIZE_ADDRESS__)
|
677
680
|
#define GRPC_ASAN_ENABLED
|
678
681
|
#elif GPR_HAS_FEATURE(address_sanitizer)
|
679
682
|
#define GRPC_ASAN_ENABLED
|
680
683
|
#endif
|
684
|
+
#endif
|
681
685
|
|
682
686
|
/* GRPC_ALLOW_EXCEPTIONS should be 0 or 1 if exceptions are allowed or not */
|
683
687
|
#ifndef GRPC_ALLOW_EXCEPTIONS
|
@@ -2,77 +2,62 @@
|
|
2
2
|
framework module grpc {
|
3
3
|
umbrella header "grpc.h"
|
4
4
|
|
5
|
-
header "support/alloc.h"
|
6
|
-
header "support/atm.h"
|
7
|
-
header "support/cpu.h"
|
8
|
-
header "support/log.h"
|
9
|
-
header "support/log_windows.h"
|
10
|
-
header "support/port_platform.h"
|
11
|
-
header "support/string_util.h"
|
12
|
-
header "support/sync.h"
|
13
|
-
header "support/sync_abseil.h"
|
14
|
-
header "support/sync_generic.h"
|
15
|
-
header "support/thd_id.h"
|
16
|
-
header "support/time.h"
|
17
5
|
header "impl/codegen/atm.h"
|
18
|
-
header "impl/codegen/fork.h"
|
19
|
-
header "impl/codegen/gpr_slice.h"
|
20
|
-
header "impl/codegen/gpr_types.h"
|
21
|
-
header "impl/codegen/log.h"
|
22
|
-
header "impl/codegen/port_platform.h"
|
23
|
-
header "impl/codegen/sync.h"
|
24
|
-
header "impl/codegen/sync_abseil.h"
|
25
|
-
header "impl/codegen/sync_generic.h"
|
26
6
|
header "impl/codegen/byte_buffer.h"
|
27
7
|
header "impl/codegen/byte_buffer_reader.h"
|
28
8
|
header "impl/codegen/compression_types.h"
|
29
9
|
header "impl/codegen/connectivity_state.h"
|
30
|
-
header "impl/codegen/grpc_types.h"
|
31
|
-
header "impl/codegen/propagation_bits.h"
|
32
|
-
header "impl/codegen/slice.h"
|
33
|
-
header "impl/codegen/status.h"
|
34
|
-
header "impl/codegen/atm.h"
|
35
10
|
header "impl/codegen/fork.h"
|
36
11
|
header "impl/codegen/gpr_slice.h"
|
37
12
|
header "impl/codegen/gpr_types.h"
|
13
|
+
header "impl/codegen/grpc_types.h"
|
38
14
|
header "impl/codegen/log.h"
|
39
15
|
header "impl/codegen/port_platform.h"
|
16
|
+
header "impl/codegen/propagation_bits.h"
|
17
|
+
header "impl/codegen/slice.h"
|
18
|
+
header "impl/codegen/status.h"
|
40
19
|
header "impl/codegen/sync.h"
|
41
20
|
header "impl/codegen/sync_abseil.h"
|
42
21
|
header "impl/codegen/sync_generic.h"
|
43
|
-
header "
|
22
|
+
header "support/alloc.h"
|
23
|
+
header "support/atm.h"
|
24
|
+
header "support/cpu.h"
|
25
|
+
header "support/log.h"
|
26
|
+
header "support/log_windows.h"
|
27
|
+
header "support/port_platform.h"
|
28
|
+
header "support/string_util.h"
|
29
|
+
header "support/sync.h"
|
30
|
+
header "support/sync_abseil.h"
|
31
|
+
header "support/sync_generic.h"
|
32
|
+
header "support/thd_id.h"
|
33
|
+
header "support/time.h"
|
44
34
|
header "byte_buffer.h"
|
45
35
|
header "byte_buffer_reader.h"
|
36
|
+
header "census.h"
|
46
37
|
header "compression.h"
|
47
38
|
header "fork.h"
|
48
39
|
header "grpc.h"
|
49
40
|
header "grpc_posix.h"
|
41
|
+
header "grpc_security.h"
|
50
42
|
header "grpc_security_constants.h"
|
51
43
|
header "load_reporting.h"
|
52
44
|
header "slice.h"
|
53
45
|
header "slice_buffer.h"
|
54
46
|
header "status.h"
|
55
47
|
header "support/workaround_list.h"
|
56
|
-
header "census.h"
|
57
48
|
|
58
|
-
textual header "support/atm_gcc_atomic.h"
|
59
|
-
textual header "support/atm_gcc_sync.h"
|
60
|
-
textual header "support/atm_windows.h"
|
61
|
-
textual header "support/sync_custom.h"
|
62
|
-
textual header "support/sync_posix.h"
|
63
|
-
textual header "support/sync_windows.h"
|
64
|
-
textual header "impl/codegen/atm_gcc_atomic.h"
|
65
|
-
textual header "impl/codegen/atm_gcc_sync.h"
|
66
|
-
textual header "impl/codegen/atm_windows.h"
|
67
|
-
textual header "impl/codegen/sync_custom.h"
|
68
|
-
textual header "impl/codegen/sync_posix.h"
|
69
|
-
textual header "impl/codegen/sync_windows.h"
|
70
49
|
textual header "impl/codegen/atm_gcc_atomic.h"
|
71
50
|
textual header "impl/codegen/atm_gcc_sync.h"
|
72
51
|
textual header "impl/codegen/atm_windows.h"
|
73
52
|
textual header "impl/codegen/sync_custom.h"
|
74
53
|
textual header "impl/codegen/sync_posix.h"
|
75
54
|
textual header "impl/codegen/sync_windows.h"
|
55
|
+
textual header "support/atm_gcc_atomic.h"
|
56
|
+
textual header "support/atm_gcc_sync.h"
|
57
|
+
textual header "support/atm_windows.h"
|
58
|
+
textual header "support/sync_custom.h"
|
59
|
+
textual header "support/sync_posix.h"
|
60
|
+
textual header "support/sync_windows.h"
|
76
61
|
|
77
62
|
export *
|
78
63
|
module * { export * }
|
@@ -18,27 +18,30 @@
|
|
18
18
|
|
19
19
|
#include "src/core/ext/filters/client_channel/backend_metric.h"
|
20
20
|
|
21
|
-
#include "
|
21
|
+
#include "absl/strings/string_view.h"
|
22
|
+
|
22
23
|
#include "udpa/data/orca/v1/orca_load_report.upb.h"
|
23
24
|
|
25
|
+
#include "src/core/lib/gprpp/map.h"
|
26
|
+
|
24
27
|
namespace grpc_core {
|
25
28
|
|
26
29
|
namespace {
|
27
30
|
|
28
31
|
template <typename EntryType>
|
29
|
-
std::map<
|
32
|
+
std::map<absl::string_view, double, StringLess> ParseMap(
|
30
33
|
udpa_data_orca_v1_OrcaLoadReport* msg,
|
31
34
|
EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
|
32
35
|
upb_strview (*key_func)(const EntryType*),
|
33
36
|
double (*value_func)(const EntryType*), Arena* arena) {
|
34
|
-
std::map<
|
37
|
+
std::map<absl::string_view, double, StringLess> result;
|
35
38
|
size_t size;
|
36
39
|
const auto* const* entries = entry_func(msg, &size);
|
37
40
|
for (size_t i = 0; i < size; ++i) {
|
38
41
|
upb_strview key_view = key_func(entries[i]);
|
39
42
|
char* key = static_cast<char*>(arena->Alloc(key_view.size + 1));
|
40
43
|
memcpy(key, key_view.data, key_view.size);
|
41
|
-
result[
|
44
|
+
result[absl::string_view(key, key_view.size)] = value_func(entries[i]);
|
42
45
|
}
|
43
46
|
return result;
|
44
47
|
}
|
@@ -28,11 +28,16 @@
|
|
28
28
|
|
29
29
|
#include <set>
|
30
30
|
|
31
|
+
#include "absl/strings/string_view.h"
|
32
|
+
|
31
33
|
#include <grpc/support/alloc.h>
|
32
34
|
#include <grpc/support/log.h>
|
33
35
|
#include <grpc/support/string_util.h>
|
34
36
|
#include <grpc/support/sync.h>
|
35
37
|
|
38
|
+
#include "absl/container/inlined_vector.h"
|
39
|
+
#include "absl/types/optional.h"
|
40
|
+
|
36
41
|
#include "src/core/ext/filters/client_channel/backend_metric.h"
|
37
42
|
#include "src/core/ext/filters/client_channel/backup_poller.h"
|
38
43
|
#include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
|
@@ -45,6 +50,7 @@
|
|
45
50
|
#include "src/core/ext/filters/client_channel/resolving_lb_policy.h"
|
46
51
|
#include "src/core/ext/filters/client_channel/retry_throttle.h"
|
47
52
|
#include "src/core/ext/filters/client_channel/service_config.h"
|
53
|
+
#include "src/core/ext/filters/client_channel/service_config_call_data.h"
|
48
54
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
49
55
|
#include "src/core/ext/filters/deadline/deadline_filter.h"
|
50
56
|
#include "src/core/lib/backoff/backoff.h"
|
@@ -52,13 +58,12 @@
|
|
52
58
|
#include "src/core/lib/channel/connected_channel.h"
|
53
59
|
#include "src/core/lib/channel/status_util.h"
|
54
60
|
#include "src/core/lib/gpr/string.h"
|
55
|
-
#include "src/core/lib/gprpp/inlined_vector.h"
|
56
61
|
#include "src/core/lib/gprpp/manual_constructor.h"
|
57
62
|
#include "src/core/lib/gprpp/map.h"
|
58
63
|
#include "src/core/lib/gprpp/sync.h"
|
59
|
-
#include "src/core/lib/iomgr/combiner.h"
|
60
64
|
#include "src/core/lib/iomgr/iomgr.h"
|
61
65
|
#include "src/core/lib/iomgr/polling_entity.h"
|
66
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
62
67
|
#include "src/core/lib/profiling/timers.h"
|
63
68
|
#include "src/core/lib/slice/slice_internal.h"
|
64
69
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
@@ -126,6 +131,7 @@ class ChannelData {
|
|
126
131
|
size_t per_rpc_retry_buffer_size() const {
|
127
132
|
return per_rpc_retry_buffer_size_;
|
128
133
|
}
|
134
|
+
grpc_channel_stack* owning_stack() const { return owning_stack_; }
|
129
135
|
|
130
136
|
// Note: Does NOT return a new ref.
|
131
137
|
grpc_error* disconnect_error() const {
|
@@ -149,6 +155,7 @@ class ChannelData {
|
|
149
155
|
RefCountedPtr<ServiceConfig> service_config() const {
|
150
156
|
return service_config_;
|
151
157
|
}
|
158
|
+
WorkSerializer* work_serializer() const { return work_serializer_.get(); }
|
152
159
|
|
153
160
|
RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannelInDataPlane(
|
154
161
|
SubchannelInterface* subchannel) const;
|
@@ -159,21 +166,29 @@ class ChannelData {
|
|
159
166
|
grpc_connectivity_state* state,
|
160
167
|
grpc_closure* on_complete,
|
161
168
|
grpc_closure* watcher_timer_init) {
|
162
|
-
|
163
|
-
// Will be deleted when the watch is complete.
|
164
|
-
GPR_ASSERT(external_watchers_[on_complete] == nullptr);
|
165
|
-
external_watchers_[on_complete] = new ExternalConnectivityWatcher(
|
169
|
+
auto* watcher = new ExternalConnectivityWatcher(
|
166
170
|
this, pollent, state, on_complete, watcher_timer_init);
|
171
|
+
{
|
172
|
+
MutexLock lock(&external_watchers_mu_);
|
173
|
+
// Will be deleted when the watch is complete.
|
174
|
+
GPR_ASSERT(external_watchers_[on_complete] == nullptr);
|
175
|
+
external_watchers_[on_complete] = watcher;
|
176
|
+
}
|
177
|
+
watcher->Start();
|
167
178
|
}
|
168
179
|
|
169
180
|
void RemoveExternalConnectivityWatcher(grpc_closure* on_complete,
|
170
181
|
bool cancel) {
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
external_watchers_.
|
182
|
+
ExternalConnectivityWatcher* watcher = nullptr;
|
183
|
+
{
|
184
|
+
MutexLock lock(&external_watchers_mu_);
|
185
|
+
auto it = external_watchers_.find(on_complete);
|
186
|
+
if (it != external_watchers_.end()) {
|
187
|
+
watcher = it->second;
|
188
|
+
external_watchers_.erase(it);
|
189
|
+
}
|
176
190
|
}
|
191
|
+
if (watcher != nullptr && cancel) watcher->Cancel();
|
177
192
|
}
|
178
193
|
|
179
194
|
int NumExternalConnectivityWatchers() const {
|
@@ -204,13 +219,15 @@ class ChannelData {
|
|
204
219
|
|
205
220
|
~ExternalConnectivityWatcher();
|
206
221
|
|
222
|
+
void Start();
|
223
|
+
|
207
224
|
void Notify(grpc_connectivity_state state) override;
|
208
225
|
|
209
226
|
void Cancel();
|
210
227
|
|
211
228
|
private:
|
212
|
-
|
213
|
-
|
229
|
+
void AddWatcherLocked();
|
230
|
+
void RemoveWatcherLocked();
|
214
231
|
|
215
232
|
ChannelData* chand_;
|
216
233
|
grpc_polling_entity pollent_;
|
@@ -218,8 +235,6 @@ class ChannelData {
|
|
218
235
|
grpc_connectivity_state* state_;
|
219
236
|
grpc_closure* on_complete_;
|
220
237
|
grpc_closure* watcher_timer_init_;
|
221
|
-
grpc_closure add_closure_;
|
222
|
-
grpc_closure remove_closure_;
|
223
238
|
Atomic<bool> done_{false};
|
224
239
|
};
|
225
240
|
|
@@ -245,9 +260,9 @@ class ChannelData {
|
|
245
260
|
|
246
261
|
grpc_error* DoPingLocked(grpc_transport_op* op);
|
247
262
|
|
248
|
-
|
263
|
+
void StartTransportOpLocked(grpc_transport_op* op);
|
249
264
|
|
250
|
-
|
265
|
+
void TryToConnectLocked();
|
251
266
|
|
252
267
|
void ProcessLbPolicy(
|
253
268
|
const Resolver::Result& resolver_result,
|
@@ -280,9 +295,9 @@ class ChannelData {
|
|
280
295
|
RefCountedPtr<ServiceConfig> service_config_;
|
281
296
|
|
282
297
|
//
|
283
|
-
// Fields used in the control plane. Guarded by
|
298
|
+
// Fields used in the control plane. Guarded by work_serializer.
|
284
299
|
//
|
285
|
-
|
300
|
+
std::shared_ptr<WorkSerializer> work_serializer_;
|
286
301
|
grpc_pollset_set* interested_parties_;
|
287
302
|
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
|
288
303
|
OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
|
@@ -294,17 +309,17 @@ class ChannelData {
|
|
294
309
|
std::map<Subchannel*, int> subchannel_refcount_map_;
|
295
310
|
// The set of SubchannelWrappers that currently exist.
|
296
311
|
// No need to hold a ref, since the map is updated in the control-plane
|
297
|
-
//
|
312
|
+
// work_serializer when the SubchannelWrappers are created and destroyed.
|
298
313
|
std::set<SubchannelWrapper*> subchannel_wrappers_;
|
299
314
|
// Pending ConnectedSubchannel updates for each SubchannelWrapper.
|
300
|
-
// Updates are queued here in the control plane
|
301
|
-
// in the data plane mutex when the picker is updated.
|
302
|
-
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel
|
303
|
-
RefCountedPtrLess<SubchannelWrapper>>
|
315
|
+
// Updates are queued here in the control plane work_serializer and then
|
316
|
+
// applied in the data plane mutex when the picker is updated.
|
317
|
+
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
|
304
318
|
pending_subchannel_updates_;
|
305
319
|
|
306
320
|
//
|
307
|
-
// Fields accessed from both data plane mutex and control plane
|
321
|
+
// Fields accessed from both data plane mutex and control plane
|
322
|
+
// work_serializer.
|
308
323
|
//
|
309
324
|
Atomic<grpc_error*> disconnect_error_;
|
310
325
|
|
@@ -364,7 +379,7 @@ class CallData {
|
|
364
379
|
Metadata(CallData* calld, grpc_metadata_batch* batch)
|
365
380
|
: calld_(calld), batch_(batch) {}
|
366
381
|
|
367
|
-
void Add(
|
382
|
+
void Add(absl::string_view key, absl::string_view value) override {
|
368
383
|
grpc_linked_mdelem* linked_mdelem = static_cast<grpc_linked_mdelem*>(
|
369
384
|
calld_->arena_->Alloc(sizeof(grpc_linked_mdelem)));
|
370
385
|
linked_mdelem->md = grpc_mdelem_from_slices(
|
@@ -399,7 +414,7 @@ class CallData {
|
|
399
414
|
reinterpret_cast<grpc_linked_mdelem*>(handle);
|
400
415
|
return reinterpret_cast<intptr_t>(linked_mdelem->next);
|
401
416
|
}
|
402
|
-
std::pair<
|
417
|
+
std::pair<absl::string_view, absl::string_view> IteratorHandleGet(
|
403
418
|
intptr_t handle) const override {
|
404
419
|
grpc_linked_mdelem* linked_mdelem =
|
405
420
|
reinterpret_cast<grpc_linked_mdelem*>(handle);
|
@@ -431,6 +446,12 @@ class CallData {
|
|
431
446
|
return calld_->backend_metric_data_;
|
432
447
|
}
|
433
448
|
|
449
|
+
absl::string_view ExperimentalGetCallAttribute(const char* key) override {
|
450
|
+
auto it = calld_->call_attributes_.find(key);
|
451
|
+
if (it == calld_->call_attributes_.end()) return absl::string_view();
|
452
|
+
return it->second;
|
453
|
+
}
|
454
|
+
|
434
455
|
private:
|
435
456
|
CallData* calld_;
|
436
457
|
};
|
@@ -750,8 +771,8 @@ class CallData {
|
|
750
771
|
grpc_call_context_element* call_context_;
|
751
772
|
|
752
773
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_;
|
753
|
-
ServiceConfig::CallData service_config_call_data_;
|
754
774
|
const ClientChannelMethodParsedConfig* method_params_ = nullptr;
|
775
|
+
std::map<const char*, absl::string_view> call_attributes_;
|
755
776
|
|
756
777
|
RefCountedPtr<SubchannelCall> subchannel_call_;
|
757
778
|
|
@@ -820,7 +841,7 @@ class CallData {
|
|
820
841
|
// Note: We inline the cache for the first 3 send_message ops and use
|
821
842
|
// dynamic allocation after that. This number was essentially picked
|
822
843
|
// at random; it could be changed in the future to tune performance.
|
823
|
-
InlinedVector<ByteStreamCache*, 3> send_messages_;
|
844
|
+
absl::InlinedVector<ByteStreamCache*, 3> send_messages_;
|
824
845
|
// send_trailing_metadata
|
825
846
|
bool seen_send_trailing_metadata_ = false;
|
826
847
|
grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr;
|
@@ -838,7 +859,7 @@ class CallData {
|
|
838
859
|
// Note that no synchronization is needed here, because even if the
|
839
860
|
// underlying subchannel is shared between channels, this wrapper will only
|
840
861
|
// be used within one channel, so it will always be synchronized by the
|
841
|
-
// control plane
|
862
|
+
// control plane work_serializer.
|
842
863
|
class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
843
864
|
public:
|
844
865
|
SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
|
@@ -907,7 +928,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
907
928
|
initial_state,
|
908
929
|
grpc_core::UniquePtr<char>(
|
909
930
|
gpr_strdup(health_check_service_name_.get())),
|
910
|
-
|
931
|
+
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
|
911
932
|
watcher_wrapper));
|
912
933
|
}
|
913
934
|
|
@@ -957,14 +978,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
957
978
|
replacement->last_seen_state(),
|
958
979
|
grpc_core::UniquePtr<char>(
|
959
980
|
gpr_strdup(health_check_service_name.get())),
|
960
|
-
|
981
|
+
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
|
961
982
|
replacement));
|
962
983
|
}
|
963
984
|
// Save the new health check service name.
|
964
985
|
health_check_service_name_ = std::move(health_check_service_name);
|
965
986
|
}
|
966
987
|
|
967
|
-
// Caller must be holding the control-plane
|
988
|
+
// Caller must be holding the control-plane work_serializer.
|
968
989
|
ConnectedSubchannel* connected_subchannel() const {
|
969
990
|
return connected_subchannel_.get();
|
970
991
|
}
|
@@ -1004,23 +1025,27 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1004
1025
|
parent_(std::move(parent)),
|
1005
1026
|
last_seen_state_(initial_state) {}
|
1006
1027
|
|
1007
|
-
~WatcherWrapper() {
|
1008
|
-
|
1009
|
-
|
1028
|
+
~WatcherWrapper() {
|
1029
|
+
auto* parent = parent_.release(); // ref owned by lambda
|
1030
|
+
parent->chand_->work_serializer_->Run(
|
1031
|
+
[parent]() { parent->Unref(DEBUG_LOCATION, "WatcherWrapper"); },
|
1032
|
+
DEBUG_LOCATION);
|
1033
|
+
}
|
1010
1034
|
|
1011
|
-
void OnConnectivityStateChange(
|
1012
|
-
grpc_connectivity_state new_state,
|
1013
|
-
RefCountedPtr<ConnectedSubchannel> connected_subchannel) override {
|
1035
|
+
void OnConnectivityStateChange() override {
|
1014
1036
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1015
1037
|
gpr_log(GPR_INFO,
|
1016
1038
|
"chand=%p: connectivity change for subchannel wrapper %p "
|
1017
|
-
"subchannel %p
|
1018
|
-
|
1019
|
-
parent_->chand_, parent_.get(), parent_->subchannel_,
|
1020
|
-
connected_subchannel.get(), ConnectivityStateName(new_state));
|
1039
|
+
"subchannel %p; hopping into work_serializer",
|
1040
|
+
parent_->chand_, parent_.get(), parent_->subchannel_);
|
1021
1041
|
}
|
1022
|
-
//
|
1023
|
-
|
1042
|
+
Ref().release(); // ref owned by lambda
|
1043
|
+
parent_->chand_->work_serializer_->Run(
|
1044
|
+
[this]() {
|
1045
|
+
ApplyUpdateInControlPlaneWorkSerializer();
|
1046
|
+
Unref();
|
1047
|
+
},
|
1048
|
+
DEBUG_LOCATION);
|
1024
1049
|
}
|
1025
1050
|
|
1026
1051
|
grpc_pollset_set* interested_parties() override {
|
@@ -1040,50 +1065,25 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1040
1065
|
grpc_connectivity_state last_seen_state() const { return last_seen_state_; }
|
1041
1066
|
|
1042
1067
|
private:
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
parent_->parent_->chand_->combiner_->Run(
|
1052
|
-
GRPC_CLOSURE_INIT(&closure_, ApplyUpdateInControlPlaneCombiner,
|
1053
|
-
this, nullptr),
|
1054
|
-
GRPC_ERROR_NONE);
|
1068
|
+
void ApplyUpdateInControlPlaneWorkSerializer() {
|
1069
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1070
|
+
gpr_log(GPR_INFO,
|
1071
|
+
"chand=%p: processing connectivity change in work serializer "
|
1072
|
+
"for subchannel wrapper %p subchannel %p "
|
1073
|
+
"watcher=%p",
|
1074
|
+
parent_->chand_, parent_.get(), parent_->subchannel_,
|
1075
|
+
watcher_.get());
|
1055
1076
|
}
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
"for subchannel wrapper %p subchannel %p "
|
1065
|
-
"(connected_subchannel=%p state=%s): watcher=%p",
|
1066
|
-
self->parent_->parent_->chand_, self->parent_->parent_.get(),
|
1067
|
-
self->parent_->parent_->subchannel_,
|
1068
|
-
self->connected_subchannel_.get(),
|
1069
|
-
ConnectivityStateName(self->state_),
|
1070
|
-
self->parent_->watcher_.get());
|
1071
|
-
}
|
1072
|
-
// Ignore update if the parent WatcherWrapper has been replaced
|
1073
|
-
// since this callback was scheduled.
|
1074
|
-
if (self->parent_->watcher_ == nullptr) return;
|
1075
|
-
self->parent_->last_seen_state_ = self->state_;
|
1076
|
-
self->parent_->parent_->MaybeUpdateConnectedSubchannel(
|
1077
|
-
std::move(self->connected_subchannel_));
|
1078
|
-
self->parent_->watcher_->OnConnectivityStateChange(self->state_);
|
1079
|
-
delete self;
|
1077
|
+
ConnectivityStateChange state_change = PopConnectivityStateChange();
|
1078
|
+
// Ignore update if the parent WatcherWrapper has been replaced
|
1079
|
+
// since this callback was scheduled.
|
1080
|
+
if (watcher_ != nullptr) {
|
1081
|
+
last_seen_state_ = state_change.state;
|
1082
|
+
parent_->MaybeUpdateConnectedSubchannel(
|
1083
|
+
std::move(state_change.connected_subchannel));
|
1084
|
+
watcher_->OnConnectivityStateChange(state_change.state);
|
1080
1085
|
}
|
1081
|
-
|
1082
|
-
RefCountedPtr<WatcherWrapper> parent_;
|
1083
|
-
grpc_connectivity_state state_;
|
1084
|
-
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
1085
|
-
grpc_closure closure_;
|
1086
|
-
};
|
1086
|
+
}
|
1087
1087
|
|
1088
1088
|
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
|
1089
1089
|
watcher_;
|
@@ -1122,7 +1122,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1122
1122
|
// CancelConnectivityStateWatch() with its watcher, we know the
|
1123
1123
|
// corresponding WrapperWatcher to cancel on the underlying subchannel.
|
1124
1124
|
std::map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
|
1125
|
-
// To be accessed only in the control plane
|
1125
|
+
// To be accessed only in the control plane work_serializer.
|
1126
1126
|
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
1127
1127
|
// To be accessed only in the data plane mutex.
|
1128
1128
|
RefCountedPtr<ConnectedSubchannel> connected_subchannel_in_data_plane_;
|
@@ -1145,9 +1145,6 @@ ChannelData::ExternalConnectivityWatcher::ExternalConnectivityWatcher(
|
|
1145
1145
|
grpc_polling_entity_add_to_pollset_set(&pollent_,
|
1146
1146
|
chand_->interested_parties_);
|
1147
1147
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ExternalConnectivityWatcher");
|
1148
|
-
chand_->combiner_->Run(
|
1149
|
-
GRPC_CLOSURE_INIT(&add_closure_, AddWatcherLocked, this, nullptr),
|
1150
|
-
GRPC_ERROR_NONE);
|
1151
1148
|
}
|
1152
1149
|
|
1153
1150
|
ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
|
@@ -1157,6 +1154,11 @@ ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
|
|
1157
1154
|
"ExternalConnectivityWatcher");
|
1158
1155
|
}
|
1159
1156
|
|
1157
|
+
void ChannelData::ExternalConnectivityWatcher::Start() {
|
1158
|
+
chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
|
1159
|
+
DEBUG_LOCATION);
|
1160
|
+
}
|
1161
|
+
|
1160
1162
|
void ChannelData::ExternalConnectivityWatcher::Notify(
|
1161
1163
|
grpc_connectivity_state state) {
|
1162
1164
|
bool done = false;
|
@@ -1169,13 +1171,12 @@ void ChannelData::ExternalConnectivityWatcher::Notify(
|
|
1169
1171
|
// Report new state to the user.
|
1170
1172
|
*state_ = state;
|
1171
1173
|
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_NONE);
|
1172
|
-
// Hop back into the
|
1174
|
+
// Hop back into the work_serializer to clean up.
|
1173
1175
|
// Not needed in state SHUTDOWN, because the tracker will
|
1174
1176
|
// automatically remove all watchers in that case.
|
1175
1177
|
if (state != GRPC_CHANNEL_SHUTDOWN) {
|
1176
|
-
chand_->
|
1177
|
-
|
1178
|
-
GRPC_ERROR_NONE);
|
1178
|
+
chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
|
1179
|
+
DEBUG_LOCATION);
|
1179
1180
|
}
|
1180
1181
|
}
|
1181
1182
|
|
@@ -1186,28 +1187,20 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
|
|
1186
1187
|
return; // Already done.
|
1187
1188
|
}
|
1188
1189
|
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_CANCELLED);
|
1189
|
-
// Hop back into the
|
1190
|
-
chand_->
|
1191
|
-
|
1192
|
-
GRPC_ERROR_NONE);
|
1190
|
+
// Hop back into the work_serializer to clean up.
|
1191
|
+
chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
|
1192
|
+
DEBUG_LOCATION);
|
1193
1193
|
}
|
1194
1194
|
|
1195
|
-
void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked(
|
1196
|
-
|
1197
|
-
ExternalConnectivityWatcher* self =
|
1198
|
-
static_cast<ExternalConnectivityWatcher*>(arg);
|
1199
|
-
Closure::Run(DEBUG_LOCATION, self->watcher_timer_init_, GRPC_ERROR_NONE);
|
1195
|
+
void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked() {
|
1196
|
+
Closure::Run(DEBUG_LOCATION, watcher_timer_init_, GRPC_ERROR_NONE);
|
1200
1197
|
// Add new watcher.
|
1201
|
-
|
1202
|
-
|
1203
|
-
OrphanablePtr<ConnectivityStateWatcherInterface>(self));
|
1198
|
+
chand_->state_tracker_.AddWatcher(
|
1199
|
+
initial_state_, OrphanablePtr<ConnectivityStateWatcherInterface>(this));
|
1204
1200
|
}
|
1205
1201
|
|
1206
|
-
void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked(
|
1207
|
-
|
1208
|
-
ExternalConnectivityWatcher* self =
|
1209
|
-
static_cast<ExternalConnectivityWatcher*>(arg);
|
1210
|
-
self->chand_->state_tracker_.RemoveWatcher(self);
|
1202
|
+
void ChannelData::ExternalConnectivityWatcher::RemoveWatcherLocked() {
|
1203
|
+
chand_->state_tracker_.RemoveWatcher(this);
|
1211
1204
|
}
|
1212
1205
|
|
1213
1206
|
//
|
@@ -1223,28 +1216,20 @@ class ChannelData::ConnectivityWatcherAdder {
|
|
1223
1216
|
initial_state_(initial_state),
|
1224
1217
|
watcher_(std::move(watcher)) {
|
1225
1218
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ConnectivityWatcherAdder");
|
1226
|
-
chand_->
|
1227
|
-
|
1228
|
-
&ConnectivityWatcherAdder::AddWatcherLocked, this,
|
1229
|
-
nullptr),
|
1230
|
-
GRPC_ERROR_NONE);
|
1219
|
+
chand_->work_serializer_->Run([this]() { AddWatcherLocked(); },
|
1220
|
+
DEBUG_LOCATION);
|
1231
1221
|
}
|
1232
1222
|
|
1233
1223
|
private:
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
std::move(self->watcher_));
|
1239
|
-
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
|
1240
|
-
"ConnectivityWatcherAdder");
|
1241
|
-
delete self;
|
1224
|
+
void AddWatcherLocked() {
|
1225
|
+
chand_->state_tracker_.AddWatcher(initial_state_, std::move(watcher_));
|
1226
|
+
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "ConnectivityWatcherAdder");
|
1227
|
+
delete this;
|
1242
1228
|
}
|
1243
1229
|
|
1244
1230
|
ChannelData* chand_;
|
1245
1231
|
grpc_connectivity_state initial_state_;
|
1246
1232
|
OrphanablePtr<AsyncConnectivityStateWatcherInterface> watcher_;
|
1247
|
-
grpc_closure closure_;
|
1248
1233
|
};
|
1249
1234
|
|
1250
1235
|
//
|
@@ -1257,26 +1242,20 @@ class ChannelData::ConnectivityWatcherRemover {
|
|
1257
1242
|
AsyncConnectivityStateWatcherInterface* watcher)
|
1258
1243
|
: chand_(chand), watcher_(watcher) {
|
1259
1244
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ConnectivityWatcherRemover");
|
1260
|
-
chand_->
|
1261
|
-
|
1262
|
-
&ConnectivityWatcherRemover::RemoveWatcherLocked,
|
1263
|
-
this, nullptr),
|
1264
|
-
GRPC_ERROR_NONE);
|
1245
|
+
chand_->work_serializer_->Run([this]() { RemoveWatcherLocked(); },
|
1246
|
+
DEBUG_LOCATION);
|
1265
1247
|
}
|
1266
1248
|
|
1267
1249
|
private:
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
self->chand_->state_tracker_.RemoveWatcher(self->watcher_);
|
1272
|
-
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
|
1250
|
+
void RemoveWatcherLocked() {
|
1251
|
+
chand_->state_tracker_.RemoveWatcher(watcher_);
|
1252
|
+
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_,
|
1273
1253
|
"ConnectivityWatcherRemover");
|
1274
|
-
delete
|
1254
|
+
delete this;
|
1275
1255
|
}
|
1276
1256
|
|
1277
1257
|
ChannelData* chand_;
|
1278
1258
|
AsyncConnectivityStateWatcherInterface* watcher_;
|
1279
|
-
grpc_closure closure_;
|
1280
1259
|
};
|
1281
1260
|
|
1282
1261
|
//
|
@@ -1340,7 +1319,8 @@ class ChannelData::ClientChannelControlHelper
|
|
1340
1319
|
// No-op -- we should never get this from ResolvingLoadBalancingPolicy.
|
1341
1320
|
void RequestReresolution() override {}
|
1342
1321
|
|
1343
|
-
void AddTraceEvent(TraceSeverity severity,
|
1322
|
+
void AddTraceEvent(TraceSeverity severity,
|
1323
|
+
absl::string_view message) override {
|
1344
1324
|
if (chand_->channelz_node_ != nullptr) {
|
1345
1325
|
chand_->channelz_node_->AddTraceEvent(
|
1346
1326
|
ConvertSeverityEnum(severity),
|
@@ -1417,7 +1397,7 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
|
|
1417
1397
|
client_channel_factory_(
|
1418
1398
|
ClientChannelFactory::GetFromChannelArgs(args->channel_args)),
|
1419
1399
|
channelz_node_(GetChannelzNode(args->channel_args)),
|
1420
|
-
|
1400
|
+
work_serializer_(std::make_shared<WorkSerializer>()),
|
1421
1401
|
interested_parties_(grpc_pollset_set_create()),
|
1422
1402
|
subchannel_pool_(GetSubchannelPool(args->channel_args)),
|
1423
1403
|
state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
|
@@ -1488,7 +1468,6 @@ ChannelData::~ChannelData() {
|
|
1488
1468
|
// Stop backup polling.
|
1489
1469
|
grpc_client_channel_stop_backup_polling(interested_parties_);
|
1490
1470
|
grpc_pollset_set_destroy(interested_parties_);
|
1491
|
-
GRPC_COMBINER_UNREF(combiner_, "client_channel");
|
1492
1471
|
GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED));
|
1493
1472
|
gpr_mu_destroy(&info_mu_);
|
1494
1473
|
}
|
@@ -1592,7 +1571,7 @@ void ChannelData::UpdateServiceConfigLocked(
|
|
1592
1571
|
void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
|
1593
1572
|
// Instantiate resolving LB policy.
|
1594
1573
|
LoadBalancingPolicy::Args lb_args;
|
1595
|
-
lb_args.
|
1574
|
+
lb_args.work_serializer = work_serializer_;
|
1596
1575
|
lb_args.channel_control_helper =
|
1597
1576
|
absl::make_unique<ClientChannelControlHelper>(this);
|
1598
1577
|
lb_args.args = channel_args_;
|
@@ -1630,32 +1609,13 @@ void ChannelData::ProcessLbPolicy(
|
|
1630
1609
|
// If not, try the setting from channel args.
|
1631
1610
|
const char* policy_name = nullptr;
|
1632
1611
|
if (parsed_service_config != nullptr &&
|
1633
|
-
parsed_service_config->parsed_deprecated_lb_policy()
|
1634
|
-
policy_name = parsed_service_config->parsed_deprecated_lb_policy();
|
1612
|
+
!parsed_service_config->parsed_deprecated_lb_policy().empty()) {
|
1613
|
+
policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
|
1635
1614
|
} else {
|
1636
1615
|
const grpc_arg* channel_arg =
|
1637
1616
|
grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
|
1638
1617
|
policy_name = grpc_channel_arg_get_string(channel_arg);
|
1639
1618
|
}
|
1640
|
-
// Special case: If at least one balancer address is present, we use
|
1641
|
-
// the grpclb policy, regardless of what the resolver has returned.
|
1642
|
-
bool found_balancer_address = false;
|
1643
|
-
for (size_t i = 0; i < resolver_result.addresses.size(); ++i) {
|
1644
|
-
const ServerAddress& address = resolver_result.addresses[i];
|
1645
|
-
if (address.IsBalancer()) {
|
1646
|
-
found_balancer_address = true;
|
1647
|
-
break;
|
1648
|
-
}
|
1649
|
-
}
|
1650
|
-
if (found_balancer_address) {
|
1651
|
-
if (policy_name != nullptr && strcmp(policy_name, "grpclb") != 0) {
|
1652
|
-
gpr_log(GPR_INFO,
|
1653
|
-
"resolver requested LB policy %s but provided at least one "
|
1654
|
-
"balancer address -- forcing use of grpclb LB policy",
|
1655
|
-
policy_name);
|
1656
|
-
}
|
1657
|
-
policy_name = "grpclb";
|
1658
|
-
}
|
1659
1619
|
// Use pick_first if nothing was specified and we didn't select grpclb
|
1660
1620
|
// above.
|
1661
1621
|
if (policy_name == nullptr) policy_name = "pick_first";
|
@@ -1781,7 +1741,7 @@ bool ChannelData::ProcessResolverResultLocked(
|
|
1781
1741
|
chand->received_first_resolver_result_ = true;
|
1782
1742
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
|
1783
1743
|
if (parsed_service_config != nullptr) {
|
1784
|
-
|
1744
|
+
absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
|
1785
1745
|
retry_throttle_config = parsed_service_config->retry_throttling();
|
1786
1746
|
if (retry_throttle_config.has_value()) {
|
1787
1747
|
retry_throttle_data =
|
@@ -1832,22 +1792,18 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
|
|
1832
1792
|
return result.error;
|
1833
1793
|
}
|
1834
1794
|
|
1835
|
-
void ChannelData::StartTransportOpLocked(
|
1836
|
-
grpc_transport_op* op = static_cast<grpc_transport_op*>(arg);
|
1837
|
-
grpc_channel_element* elem =
|
1838
|
-
static_cast<grpc_channel_element*>(op->handler_private.extra_arg);
|
1839
|
-
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
1795
|
+
void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
|
1840
1796
|
// Connectivity watch.
|
1841
1797
|
if (op->start_connectivity_watch != nullptr) {
|
1842
|
-
|
1843
|
-
|
1798
|
+
state_tracker_.AddWatcher(op->start_connectivity_watch_state,
|
1799
|
+
std::move(op->start_connectivity_watch));
|
1844
1800
|
}
|
1845
1801
|
if (op->stop_connectivity_watch != nullptr) {
|
1846
|
-
|
1802
|
+
state_tracker_.RemoveWatcher(op->stop_connectivity_watch);
|
1847
1803
|
}
|
1848
1804
|
// Ping.
|
1849
1805
|
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
|
1850
|
-
grpc_error* error =
|
1806
|
+
grpc_error* error = DoPingLocked(op);
|
1851
1807
|
if (error != GRPC_ERROR_NONE) {
|
1852
1808
|
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
|
1853
1809
|
GRPC_ERROR_REF(error));
|
@@ -1859,40 +1815,39 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
|
|
1859
1815
|
}
|
1860
1816
|
// Reset backoff.
|
1861
1817
|
if (op->reset_connect_backoff) {
|
1862
|
-
if (
|
1863
|
-
|
1818
|
+
if (resolving_lb_policy_ != nullptr) {
|
1819
|
+
resolving_lb_policy_->ResetBackoffLocked();
|
1864
1820
|
}
|
1865
1821
|
}
|
1866
1822
|
// Disconnect or enter IDLE.
|
1867
1823
|
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
|
1868
1824
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
1869
|
-
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s",
|
1825
|
+
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
|
1870
1826
|
grpc_error_string(op->disconnect_with_error));
|
1871
1827
|
}
|
1872
|
-
|
1828
|
+
DestroyResolvingLoadBalancingPolicyLocked();
|
1873
1829
|
intptr_t value;
|
1874
1830
|
if (grpc_error_get_int(op->disconnect_with_error,
|
1875
1831
|
GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, &value) &&
|
1876
1832
|
static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
|
1877
|
-
if (
|
1833
|
+
if (disconnect_error() == GRPC_ERROR_NONE) {
|
1878
1834
|
// Enter IDLE state.
|
1879
|
-
|
1880
|
-
|
1835
|
+
UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, "channel entering IDLE",
|
1836
|
+
nullptr);
|
1881
1837
|
}
|
1882
1838
|
GRPC_ERROR_UNREF(op->disconnect_with_error);
|
1883
1839
|
} else {
|
1884
1840
|
// Disconnect.
|
1885
|
-
GPR_ASSERT(
|
1841
|
+
GPR_ASSERT(disconnect_error_.Load(MemoryOrder::RELAXED) ==
|
1886
1842
|
GRPC_ERROR_NONE);
|
1887
|
-
|
1888
|
-
|
1889
|
-
chand->UpdateStateAndPickerLocked(
|
1843
|
+
disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE);
|
1844
|
+
UpdateStateAndPickerLocked(
|
1890
1845
|
GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
|
1891
1846
|
absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
|
1892
1847
|
GRPC_ERROR_REF(op->disconnect_with_error)));
|
1893
1848
|
}
|
1894
1849
|
}
|
1895
|
-
GRPC_CHANNEL_STACK_UNREF(
|
1850
|
+
GRPC_CHANNEL_STACK_UNREF(owning_stack_, "start_transport_op");
|
1896
1851
|
ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE);
|
1897
1852
|
}
|
1898
1853
|
|
@@ -1904,13 +1859,10 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem,
|
|
1904
1859
|
if (op->bind_pollset != nullptr) {
|
1905
1860
|
grpc_pollset_set_add_pollset(chand->interested_parties_, op->bind_pollset);
|
1906
1861
|
}
|
1907
|
-
// Pop into control plane
|
1908
|
-
op->handler_private.extra_arg = elem;
|
1862
|
+
// Pop into control plane work_serializer for remaining ops.
|
1909
1863
|
GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "start_transport_op");
|
1910
|
-
chand->
|
1911
|
-
|
1912
|
-
ChannelData::StartTransportOpLocked, op, nullptr),
|
1913
|
-
GRPC_ERROR_NONE);
|
1864
|
+
chand->work_serializer_->Run(
|
1865
|
+
[chand, op]() { chand->StartTransportOpLocked(op); }, DEBUG_LOCATION);
|
1914
1866
|
}
|
1915
1867
|
|
1916
1868
|
void ChannelData::GetChannelInfo(grpc_channel_element* elem,
|
@@ -1961,14 +1913,13 @@ ChannelData::GetConnectedSubchannelInDataPlane(
|
|
1961
1913
|
return connected_subchannel->Ref();
|
1962
1914
|
}
|
1963
1915
|
|
1964
|
-
void ChannelData::TryToConnectLocked(
|
1965
|
-
|
1966
|
-
|
1967
|
-
chand->resolving_lb_policy_->ExitIdleLocked();
|
1916
|
+
void ChannelData::TryToConnectLocked() {
|
1917
|
+
if (resolving_lb_policy_ != nullptr) {
|
1918
|
+
resolving_lb_policy_->ExitIdleLocked();
|
1968
1919
|
} else {
|
1969
|
-
|
1920
|
+
CreateResolvingLoadBalancingPolicyLocked();
|
1970
1921
|
}
|
1971
|
-
GRPC_CHANNEL_STACK_UNREF(
|
1922
|
+
GRPC_CHANNEL_STACK_UNREF(owning_stack_, "TryToConnect");
|
1972
1923
|
}
|
1973
1924
|
|
1974
1925
|
grpc_connectivity_state ChannelData::CheckConnectivityState(
|
@@ -1976,8 +1927,7 @@ grpc_connectivity_state ChannelData::CheckConnectivityState(
|
|
1976
1927
|
grpc_connectivity_state out = state_tracker_.state();
|
1977
1928
|
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
|
1978
1929
|
GRPC_CHANNEL_STACK_REF(owning_stack_, "TryToConnect");
|
1979
|
-
|
1980
|
-
GRPC_ERROR_NONE);
|
1930
|
+
work_serializer_->Run([this]() { TryToConnectLocked(); }, DEBUG_LOCATION);
|
1981
1931
|
}
|
1982
1932
|
return out;
|
1983
1933
|
}
|
@@ -3225,10 +3175,9 @@ void CallData::OnComplete(void* arg, grpc_error* error) {
|
|
3225
3175
|
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
3226
3176
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
3227
3177
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
3228
|
-
char* batch_str = grpc_transport_stream_op_batch_string(&batch_data->batch);
|
3229
3178
|
gpr_log(GPR_INFO, "chand=%p calld=%p: got on_complete, error=%s, batch=%s",
|
3230
|
-
chand, calld, grpc_error_string(error),
|
3231
|
-
|
3179
|
+
chand, calld, grpc_error_string(error),
|
3180
|
+
grpc_transport_stream_op_batch_string(&batch_data->batch).c_str());
|
3232
3181
|
}
|
3233
3182
|
SubchannelCallRetryState* retry_state =
|
3234
3183
|
static_cast<SubchannelCallRetryState*>(
|
@@ -3301,10 +3250,8 @@ void CallData::AddClosureForSubchannelBatch(
|
|
3301
3250
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure, StartBatchInCallCombiner,
|
3302
3251
|
batch, grpc_schedule_on_exec_ctx);
|
3303
3252
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
3304
|
-
char* batch_str = grpc_transport_stream_op_batch_string(batch);
|
3305
3253
|
gpr_log(GPR_INFO, "chand=%p calld=%p: starting subchannel batch: %s", chand,
|
3306
|
-
this,
|
3307
|
-
gpr_free(batch_str);
|
3254
|
+
this, grpc_transport_stream_op_batch_string(batch).c_str());
|
3308
3255
|
}
|
3309
3256
|
closures->Add(&batch->handler_private.closure, GRPC_ERROR_NONE,
|
3310
3257
|
"start_subchannel_batch");
|
@@ -3817,45 +3764,52 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
|
|
3817
3764
|
gpr_log(GPR_INFO, "chand=%p calld=%p: applying service config to call",
|
3818
3765
|
chand, this);
|
3819
3766
|
}
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3767
|
+
auto service_config = chand->service_config();
|
3768
|
+
if (service_config != nullptr) {
|
3769
|
+
// Create a ServiceConfigCallData for the call. This stores a ref to the
|
3770
|
+
// ServiceConfig and caches the right set of parsed configs to use for
|
3771
|
+
// the call. The MethodConfig will store itself in the call context,
|
3772
|
+
// so that it can be accessed by filters in the subchannel, and it
|
3773
|
+
// will be cleaned up when the call ends.
|
3774
|
+
const auto* method_params_vector =
|
3775
|
+
service_config->GetMethodParsedConfigVector(path_);
|
3776
|
+
auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
|
3777
|
+
std::move(service_config), method_params_vector, call_context_);
|
3778
|
+
// Apply our own method params to the call.
|
3828
3779
|
method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
|
3829
|
-
|
3780
|
+
service_config_call_data->GetMethodParsedConfig(
|
3830
3781
|
internal::ClientChannelServiceConfigParser::ParserIndex()));
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3782
|
+
if (method_params_ != nullptr) {
|
3783
|
+
// If the deadline from the service config is shorter than the one
|
3784
|
+
// from the client API, reset the deadline timer.
|
3785
|
+
if (chand->deadline_checking_enabled() &&
|
3786
|
+
method_params_->timeout() != 0) {
|
3787
|
+
const grpc_millis per_method_deadline =
|
3788
|
+
grpc_cycle_counter_to_millis_round_up(call_start_time_) +
|
3789
|
+
method_params_->timeout();
|
3790
|
+
if (per_method_deadline < deadline_) {
|
3791
|
+
deadline_ = per_method_deadline;
|
3792
|
+
grpc_deadline_state_reset(elem, deadline_);
|
3793
|
+
}
|
3843
3794
|
}
|
3844
|
-
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3795
|
+
// If the service config set wait_for_ready and the application
|
3796
|
+
// did not explicitly set it, use the value from the service config.
|
3797
|
+
uint32_t* send_initial_metadata_flags =
|
3798
|
+
&pending_batches_[0]
|
3799
|
+
.batch->payload->send_initial_metadata
|
3800
|
+
.send_initial_metadata_flags;
|
3801
|
+
if (method_params_->wait_for_ready().has_value() &&
|
3802
|
+
!(*send_initial_metadata_flags &
|
3803
|
+
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET)) {
|
3804
|
+
if (method_params_->wait_for_ready().value()) {
|
3805
|
+
*send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY;
|
3806
|
+
} else {
|
3807
|
+
*send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY;
|
3808
|
+
}
|
3857
3809
|
}
|
3858
3810
|
}
|
3811
|
+
// Set retry throttle data for call.
|
3812
|
+
retry_throttle_data_ = chand->retry_throttle_data();
|
3859
3813
|
}
|
3860
3814
|
// If no retry policy, disable retries.
|
3861
3815
|
// TODO(roth): Remove this when adding support for transparent retries.
|
@@ -3911,8 +3865,25 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3911
3865
|
// The picker being null means that the channel is currently in IDLE state.
|
3912
3866
|
// The incoming call will make the channel exit IDLE.
|
3913
3867
|
if (chand->picker() == nullptr) {
|
3914
|
-
|
3915
|
-
|
3868
|
+
GRPC_CHANNEL_STACK_REF(chand->owning_stack(), "PickSubchannelLocked");
|
3869
|
+
// Bounce into the control plane work serializer to exit IDLE. Since we are
|
3870
|
+
// holding on to the data plane mutex here, we offload it on the ExecCtx so
|
3871
|
+
// that we don't deadlock with ourselves.
|
3872
|
+
ExecCtx::Run(
|
3873
|
+
DEBUG_LOCATION,
|
3874
|
+
GRPC_CLOSURE_CREATE(
|
3875
|
+
[](void* arg, grpc_error* /*error*/) {
|
3876
|
+
auto* chand = static_cast<ChannelData*>(arg);
|
3877
|
+
chand->work_serializer()->Run(
|
3878
|
+
[chand]() {
|
3879
|
+
chand->CheckConnectivityState(/*try_to_connect=*/true);
|
3880
|
+
GRPC_CHANNEL_STACK_UNREF(chand->owning_stack(),
|
3881
|
+
"PickSubchannelLocked");
|
3882
|
+
},
|
3883
|
+
DEBUG_LOCATION);
|
3884
|
+
},
|
3885
|
+
chand, nullptr),
|
3886
|
+
GRPC_ERROR_NONE);
|
3916
3887
|
// Queue the pick, so that it will be attempted once the channel
|
3917
3888
|
// becomes connected.
|
3918
3889
|
AddCallToQueuedPicksLocked(elem);
|