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
@@ -30,11 +30,10 @@
|
|
30
30
|
namespace grpc_core {
|
31
31
|
namespace channelz {
|
32
32
|
|
33
|
-
SubchannelNode::SubchannelNode(
|
33
|
+
SubchannelNode::SubchannelNode(std::string target_address,
|
34
34
|
size_t channel_tracer_max_nodes)
|
35
|
-
: BaseNode(EntityType::kSubchannel,
|
36
|
-
|
37
|
-
target_(UniquePtr<char>(gpr_strdup(target_address))),
|
35
|
+
: BaseNode(EntityType::kSubchannel, target_address),
|
36
|
+
target_(std::move(target_address)),
|
38
37
|
trace_(channel_tracer_max_nodes) {}
|
39
38
|
|
40
39
|
SubchannelNode::~SubchannelNode() {}
|
@@ -76,8 +75,8 @@ grpc_json* SubchannelNode::RenderJson() {
|
|
76
75
|
json = data;
|
77
76
|
json_iterator = nullptr;
|
78
77
|
PopulateConnectivityState(json);
|
79
|
-
GPR_ASSERT(target_.
|
80
|
-
grpc_json_create_child(nullptr, json, "target", target_.
|
78
|
+
GPR_ASSERT(!target_.empty());
|
79
|
+
grpc_json_create_child(nullptr, json, "target", target_.c_str(),
|
81
80
|
GRPC_JSON_STRING, false);
|
82
81
|
// fill in the channel trace if applicable
|
83
82
|
grpc_json* trace_json = trace_.RenderJson();
|
@@ -102,7 +101,8 @@ grpc_json* SubchannelNode::RenderJson() {
|
|
102
101
|
grpc_json* sibling_iterator = grpc_json_add_number_string_child(
|
103
102
|
json_iterator, nullptr, "socketId", child_socket->uuid());
|
104
103
|
grpc_json_create_child(sibling_iterator, json_iterator, "name",
|
105
|
-
child_socket->name(), GRPC_JSON_STRING,
|
104
|
+
child_socket->name().c_str(), GRPC_JSON_STRING,
|
105
|
+
false);
|
106
106
|
}
|
107
107
|
return top_level_json;
|
108
108
|
}
|
@@ -21,6 +21,8 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <string>
|
25
|
+
|
24
26
|
#include "src/core/lib/channel/channel_args.h"
|
25
27
|
#include "src/core/lib/channel/channel_stack.h"
|
26
28
|
#include "src/core/lib/channel/channel_trace.h"
|
@@ -34,7 +36,7 @@ namespace channelz {
|
|
34
36
|
|
35
37
|
class SubchannelNode : public BaseNode {
|
36
38
|
public:
|
37
|
-
SubchannelNode(
|
39
|
+
SubchannelNode(std::string target_address, size_t channel_tracer_max_nodes);
|
38
40
|
~SubchannelNode() override;
|
39
41
|
|
40
42
|
// Sets the subchannel's connectivity state without health checking.
|
@@ -67,7 +69,7 @@ class SubchannelNode : public BaseNode {
|
|
67
69
|
Atomic<grpc_connectivity_state> connectivity_state_{GRPC_CHANNEL_IDLE};
|
68
70
|
Mutex socket_mu_;
|
69
71
|
RefCountedPtr<SocketNode> child_socket_;
|
70
|
-
|
72
|
+
std::string target_;
|
71
73
|
CallCountingHelper call_counter_;
|
72
74
|
ChannelTrace trace_;
|
73
75
|
};
|
@@ -29,7 +29,7 @@ namespace grpc_core {
|
|
29
29
|
namespace {
|
30
30
|
|
31
31
|
void* factory_arg_copy(void* f) { return f; }
|
32
|
-
void factory_arg_destroy(void* f) {}
|
32
|
+
void factory_arg_destroy(void* /*f*/) {}
|
33
33
|
int factory_arg_cmp(void* factory1, void* factory2) {
|
34
34
|
return GPR_ICMP(factory1, factory2);
|
35
35
|
}
|
@@ -48,8 +48,8 @@ void grpc_client_channel_init(void) {
|
|
48
48
|
grpc_core::LoadBalancingPolicyRegistry::Builder::InitRegistry();
|
49
49
|
grpc_core::ResolverRegistry::Builder::InitRegistry();
|
50
50
|
grpc_core::internal::ServerRetryThrottleMap::Init();
|
51
|
-
|
52
|
-
|
51
|
+
grpc_core::ProxyMapperRegistry::Init();
|
52
|
+
grpc_core::RegisterHttpProxyMapper();
|
53
53
|
grpc_core::GlobalSubchannelPool::Init();
|
54
54
|
grpc_channel_init_register_stage(
|
55
55
|
GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter,
|
@@ -61,7 +61,7 @@ void grpc_client_channel_init(void) {
|
|
61
61
|
void grpc_client_channel_shutdown(void) {
|
62
62
|
grpc_core::GlobalSubchannelPool::Shutdown();
|
63
63
|
grpc_channel_init_shutdown();
|
64
|
-
|
64
|
+
grpc_core::ProxyMapperRegistry::Shutdown();
|
65
65
|
grpc_core::internal::ServerRetryThrottleMap::Shutdown();
|
66
66
|
grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
|
67
67
|
grpc_core::LoadBalancingPolicyRegistry::Builder::ShutdownRegistry();
|
@@ -23,62 +23,57 @@
|
|
23
23
|
|
24
24
|
#include "src/core/lib/channel/channel_stack.h"
|
25
25
|
#include "src/core/lib/channel/channelz.h"
|
26
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
26
27
|
#include "src/core/lib/iomgr/resolve_address.h"
|
27
28
|
#include "src/core/lib/transport/transport.h"
|
28
29
|
|
29
|
-
|
30
|
-
typedef struct grpc_connector_vtable grpc_connector_vtable;
|
30
|
+
namespace grpc_core {
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
// Interface for connection-establishment functionality.
|
33
|
+
// Each transport that supports client channels (e.g., not inproc) must
|
34
|
+
// supply an implementation of this.
|
35
|
+
class SubchannelConnector : public InternallyRefCounted<SubchannelConnector> {
|
36
|
+
public:
|
37
|
+
struct Args {
|
38
|
+
// Set of pollsets interested in this connection.
|
39
|
+
grpc_pollset_set* interested_parties;
|
40
|
+
// Deadline for connection.
|
41
|
+
grpc_millis deadline;
|
42
|
+
// Channel args to be passed to handshakers and transport.
|
43
|
+
const grpc_channel_args* channel_args;
|
44
|
+
};
|
35
45
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
} grpc_connect_in_args;
|
46
|
+
struct Result {
|
47
|
+
// The connected transport.
|
48
|
+
grpc_transport* transport = nullptr;
|
49
|
+
// Channel args to be passed to filters.
|
50
|
+
const grpc_channel_args* channel_args = nullptr;
|
51
|
+
// Channelz socket node of the connected transport, if any.
|
52
|
+
RefCountedPtr<channelz::SocketNode> socket_node;
|
44
53
|
|
45
|
-
|
46
|
-
|
47
|
-
|
54
|
+
void Reset() {
|
55
|
+
transport = nullptr;
|
56
|
+
channel_args = nullptr;
|
57
|
+
socket_node.reset();
|
58
|
+
}
|
59
|
+
};
|
48
60
|
|
49
|
-
|
50
|
-
|
61
|
+
// Attempts to connect.
|
62
|
+
// When complete, populates *result and invokes notify.
|
63
|
+
// Only one connection attempt may be in progress at any one time.
|
64
|
+
virtual void Connect(const Args& args, Result* result,
|
65
|
+
grpc_closure* notify) = 0;
|
51
66
|
|
52
|
-
|
53
|
-
|
54
|
-
|
67
|
+
// Cancels any in-flight connection attempt and shuts down the
|
68
|
+
// connector.
|
69
|
+
virtual void Shutdown(grpc_error* error) = 0;
|
55
70
|
|
56
|
-
void
|
57
|
-
|
58
|
-
|
59
|
-
socket = nullptr;
|
71
|
+
void Orphan() override {
|
72
|
+
Shutdown(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
|
73
|
+
Unref();
|
60
74
|
}
|
61
|
-
} grpc_connect_out_args;
|
62
|
-
|
63
|
-
struct grpc_connector_vtable {
|
64
|
-
void (*ref)(grpc_connector* connector);
|
65
|
-
void (*unref)(grpc_connector* connector);
|
66
|
-
/** Implementation of grpc_connector_shutdown */
|
67
|
-
void (*shutdown)(grpc_connector* connector, grpc_error* why);
|
68
|
-
/** Implementation of grpc_connector_connect */
|
69
|
-
void (*connect)(grpc_connector* connector,
|
70
|
-
const grpc_connect_in_args* in_args,
|
71
|
-
grpc_connect_out_args* out_args, grpc_closure* notify);
|
72
75
|
};
|
73
76
|
|
74
|
-
|
75
|
-
void grpc_connector_unref(grpc_connector* connector);
|
76
|
-
/** Connect using the connector: max one outstanding call at a time */
|
77
|
-
void grpc_connector_connect(grpc_connector* connector,
|
78
|
-
const grpc_connect_in_args* in_args,
|
79
|
-
grpc_connect_out_args* out_args,
|
80
|
-
grpc_closure* notify);
|
81
|
-
/** Cancel any pending connection */
|
82
|
-
void grpc_connector_shutdown(grpc_connector* connector, grpc_error* why);
|
77
|
+
} // namespace grpc_core
|
83
78
|
|
84
79
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */
|
@@ -35,7 +35,7 @@ GlobalSubchannelPool::~GlobalSubchannelPool() {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
void GlobalSubchannelPool::Init() {
|
38
|
-
instance_ =
|
38
|
+
instance_ = new RefCountedPtr<GlobalSubchannelPool>(
|
39
39
|
MakeRefCounted<GlobalSubchannelPool>());
|
40
40
|
}
|
41
41
|
|
@@ -45,7 +45,7 @@ void GlobalSubchannelPool::Shutdown() {
|
|
45
45
|
// To ensure Shutdown() was not called before.
|
46
46
|
GPR_ASSERT(*instance_ != nullptr);
|
47
47
|
instance_->reset();
|
48
|
-
|
48
|
+
delete instance_;
|
49
49
|
}
|
50
50
|
|
51
51
|
RefCountedPtr<GlobalSubchannelPool> GlobalSubchannelPool::instance() {
|
@@ -78,7 +78,7 @@ Subchannel* GlobalSubchannelPool::RegisterSubchannel(SubchannelKey* key,
|
|
78
78
|
// Note that we should ref the old map first because grpc_avl_add() will
|
79
79
|
// unref it while we still need to access it later.
|
80
80
|
grpc_avl new_map = grpc_avl_add(
|
81
|
-
grpc_avl_ref(old_map, nullptr),
|
81
|
+
grpc_avl_ref(old_map, nullptr), new SubchannelKey(*key),
|
82
82
|
GRPC_SUBCHANNEL_WEAK_REF(constructed, "subchannel_register+new"),
|
83
83
|
nullptr);
|
84
84
|
// Try to publish the change to the shared map. It may happen (but
|
@@ -140,28 +140,28 @@ RefCountedPtr<GlobalSubchannelPool>* GlobalSubchannelPool::instance_ = nullptr;
|
|
140
140
|
|
141
141
|
namespace {
|
142
142
|
|
143
|
-
void sck_avl_destroy(void* p, void* user_data) {
|
143
|
+
void sck_avl_destroy(void* p, void* /*user_data*/) {
|
144
144
|
SubchannelKey* key = static_cast<SubchannelKey*>(p);
|
145
|
-
|
145
|
+
delete key;
|
146
146
|
}
|
147
147
|
|
148
|
-
void* sck_avl_copy(void* p, void* unused) {
|
148
|
+
void* sck_avl_copy(void* p, void* /*unused*/) {
|
149
149
|
const SubchannelKey* key = static_cast<const SubchannelKey*>(p);
|
150
|
-
auto* new_key =
|
150
|
+
auto* new_key = new SubchannelKey(*key);
|
151
151
|
return static_cast<void*>(new_key);
|
152
152
|
}
|
153
153
|
|
154
|
-
long sck_avl_compare(void* a, void* b, void* unused) {
|
154
|
+
long sck_avl_compare(void* a, void* b, void* /*unused*/) {
|
155
155
|
const SubchannelKey* key_a = static_cast<const SubchannelKey*>(a);
|
156
156
|
const SubchannelKey* key_b = static_cast<const SubchannelKey*>(b);
|
157
157
|
return key_a->Cmp(*key_b);
|
158
158
|
}
|
159
159
|
|
160
|
-
void scv_avl_destroy(void* p, void* user_data) {
|
160
|
+
void scv_avl_destroy(void* p, void* /*user_data*/) {
|
161
161
|
GRPC_SUBCHANNEL_WEAK_UNREF((Subchannel*)p, "global_subchannel_pool");
|
162
162
|
}
|
163
163
|
|
164
|
-
void* scv_avl_copy(void* p, void* unused) {
|
164
|
+
void* scv_avl_copy(void* p, void* /*unused*/) {
|
165
165
|
GRPC_SUBCHANNEL_WEAK_REF((Subchannel*)p, "global_subchannel_pool");
|
166
166
|
return p;
|
167
167
|
}
|
@@ -200,7 +200,7 @@ bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) {
|
|
200
200
|
return false;
|
201
201
|
}
|
202
202
|
// Concatenate the slices to form a single string.
|
203
|
-
|
203
|
+
std::unique_ptr<uint8_t> recv_message_deleter;
|
204
204
|
uint8_t* recv_message;
|
205
205
|
if (slice_buffer->count == 1) {
|
206
206
|
recv_message = GRPC_SLICE_START_PTR(slice_buffer->slices[0]);
|
@@ -300,7 +300,8 @@ void HealthCheckClient::CallState::StartCall() {
|
|
300
300
|
// Schedule instead of running directly, since we must not be
|
301
301
|
// holding health_check_client_->mu_ when CallEnded() is called.
|
302
302
|
call_->Ref(DEBUG_LOCATION, "call_end_closure").release();
|
303
|
-
|
303
|
+
ExecCtx::Run(
|
304
|
+
DEBUG_LOCATION,
|
304
305
|
GRPC_CLOSURE_INIT(&batch_.handler_private.closure, CallEndedRetry, this,
|
305
306
|
grpc_schedule_on_exec_ctx),
|
306
307
|
GRPC_ERROR_NONE);
|
@@ -377,8 +378,8 @@ void HealthCheckClient::CallState::StartCall() {
|
|
377
378
|
StartBatch(&recv_trailing_metadata_batch_);
|
378
379
|
}
|
379
380
|
|
380
|
-
void HealthCheckClient::CallState::StartBatchInCallCombiner(
|
381
|
-
|
381
|
+
void HealthCheckClient::CallState::StartBatchInCallCombiner(
|
382
|
+
void* arg, grpc_error* /*error*/) {
|
382
383
|
grpc_transport_stream_op_batch* batch =
|
383
384
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
384
385
|
SubchannelCall* call =
|
@@ -396,21 +397,22 @@ void HealthCheckClient::CallState::StartBatch(
|
|
396
397
|
}
|
397
398
|
|
398
399
|
void HealthCheckClient::CallState::AfterCallStackDestruction(
|
399
|
-
void* arg, grpc_error* error) {
|
400
|
+
void* arg, grpc_error* /*error*/) {
|
400
401
|
HealthCheckClient::CallState* self =
|
401
402
|
static_cast<HealthCheckClient::CallState*>(arg);
|
402
|
-
|
403
|
+
delete self;
|
403
404
|
}
|
404
405
|
|
405
406
|
void HealthCheckClient::CallState::OnCancelComplete(void* arg,
|
406
|
-
grpc_error* error) {
|
407
|
+
grpc_error* /*error*/) {
|
407
408
|
HealthCheckClient::CallState* self =
|
408
409
|
static_cast<HealthCheckClient::CallState*>(arg);
|
409
410
|
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "health_cancel");
|
410
411
|
self->call_->Unref(DEBUG_LOCATION, "cancel");
|
411
412
|
}
|
412
413
|
|
413
|
-
void HealthCheckClient::CallState::StartCancel(void* arg,
|
414
|
+
void HealthCheckClient::CallState::StartCancel(void* arg,
|
415
|
+
grpc_error* /*error*/) {
|
414
416
|
HealthCheckClient::CallState* self =
|
415
417
|
static_cast<HealthCheckClient::CallState*>(arg);
|
416
418
|
auto* batch = grpc_make_transport_stream_op(
|
@@ -432,7 +434,8 @@ void HealthCheckClient::CallState::Cancel() {
|
|
432
434
|
}
|
433
435
|
}
|
434
436
|
|
435
|
-
void HealthCheckClient::CallState::OnComplete(void* arg,
|
437
|
+
void HealthCheckClient::CallState::OnComplete(void* arg,
|
438
|
+
grpc_error* /*error*/) {
|
436
439
|
HealthCheckClient::CallState* self =
|
437
440
|
static_cast<HealthCheckClient::CallState*>(arg);
|
438
441
|
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "on_complete");
|
@@ -441,8 +444,8 @@ void HealthCheckClient::CallState::OnComplete(void* arg, grpc_error* error) {
|
|
441
444
|
self->call_->Unref(DEBUG_LOCATION, "on_complete");
|
442
445
|
}
|
443
446
|
|
444
|
-
void HealthCheckClient::CallState::RecvInitialMetadataReady(
|
445
|
-
|
447
|
+
void HealthCheckClient::CallState::RecvInitialMetadataReady(
|
448
|
+
void* arg, grpc_error* /*error*/) {
|
446
449
|
HealthCheckClient::CallState* self =
|
447
450
|
static_cast<HealthCheckClient::CallState*>(arg);
|
448
451
|
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_initial_metadata_ready");
|
@@ -524,7 +527,7 @@ void HealthCheckClient::CallState::OnByteStreamNext(void* arg,
|
|
524
527
|
}
|
525
528
|
|
526
529
|
void HealthCheckClient::CallState::RecvMessageReady(void* arg,
|
527
|
-
grpc_error* error) {
|
530
|
+
grpc_error* /*error*/) {
|
528
531
|
HealthCheckClient::CallState* self =
|
529
532
|
static_cast<HealthCheckClient::CallState*>(arg);
|
530
533
|
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_message_ready");
|
@@ -583,7 +586,7 @@ void HealthCheckClient::CallState::RecvTrailingMetadataReady(
|
|
583
586
|
}
|
584
587
|
|
585
588
|
void HealthCheckClient::CallState::CallEndedRetry(void* arg,
|
586
|
-
grpc_error* error) {
|
589
|
+
grpc_error* /*error*/) {
|
587
590
|
HealthCheckClient::CallState* self =
|
588
591
|
static_cast<HealthCheckClient::CallState*>(arg);
|
589
592
|
self->CallEnded(true /* retry */);
|
@@ -57,8 +57,10 @@ class HttpConnectHandshaker : public Handshaker {
|
|
57
57
|
void HandshakeFailedLocked(grpc_error* error);
|
58
58
|
static void OnWriteDone(void* arg, grpc_error* error);
|
59
59
|
static void OnReadDone(void* arg, grpc_error* error);
|
60
|
+
static void OnWriteDoneScheduler(void* arg, grpc_error* error);
|
61
|
+
static void OnReadDoneScheduler(void* arg, grpc_error* error);
|
60
62
|
|
61
|
-
|
63
|
+
Mutex mu_;
|
62
64
|
|
63
65
|
bool is_shutdown_ = false;
|
64
66
|
// Endpoint and read buffer to destroy after a shutdown.
|
@@ -78,7 +80,6 @@ class HttpConnectHandshaker : public Handshaker {
|
|
78
80
|
};
|
79
81
|
|
80
82
|
HttpConnectHandshaker::~HttpConnectHandshaker() {
|
81
|
-
gpr_mu_destroy(&mu_);
|
82
83
|
if (endpoint_to_destroy_ != nullptr) {
|
83
84
|
grpc_endpoint_destroy(endpoint_to_destroy_);
|
84
85
|
}
|
@@ -125,34 +126,59 @@ void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error* error) {
|
|
125
126
|
is_shutdown_ = true;
|
126
127
|
}
|
127
128
|
// Invoke callback.
|
128
|
-
|
129
|
+
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done_, error);
|
130
|
+
}
|
131
|
+
|
132
|
+
// This callback can be invoked inline while already holding onto the mutex. To
|
133
|
+
// avoid deadlocks, schedule OnWriteDone on ExecCtx.
|
134
|
+
void HttpConnectHandshaker::OnWriteDoneScheduler(void* arg, grpc_error* error) {
|
135
|
+
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
136
|
+
grpc_core::ExecCtx::Run(
|
137
|
+
DEBUG_LOCATION,
|
138
|
+
GRPC_CLOSURE_INIT(&handshaker->request_done_closure_,
|
139
|
+
&HttpConnectHandshaker::OnWriteDone, handshaker,
|
140
|
+
grpc_schedule_on_exec_ctx),
|
141
|
+
GRPC_ERROR_REF(error));
|
129
142
|
}
|
130
143
|
|
131
144
|
// Callback invoked when finished writing HTTP CONNECT request.
|
132
145
|
void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error* error) {
|
133
146
|
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
134
|
-
|
147
|
+
ReleasableMutexLock lock(&handshaker->mu_);
|
135
148
|
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
|
136
149
|
// If the write failed or we're shutting down, clean up and invoke the
|
137
150
|
// callback with the error.
|
138
151
|
handshaker->HandshakeFailedLocked(GRPC_ERROR_REF(error));
|
139
|
-
|
152
|
+
lock.Unlock();
|
140
153
|
handshaker->Unref();
|
141
154
|
} else {
|
142
155
|
// Otherwise, read the response.
|
143
156
|
// The read callback inherits our ref to the handshaker.
|
144
|
-
grpc_endpoint_read(
|
145
|
-
|
146
|
-
|
147
|
-
|
157
|
+
grpc_endpoint_read(
|
158
|
+
handshaker->args_->endpoint, handshaker->args_->read_buffer,
|
159
|
+
GRPC_CLOSURE_INIT(&handshaker->response_read_closure_,
|
160
|
+
&HttpConnectHandshaker::OnReadDoneScheduler,
|
161
|
+
handshaker, grpc_schedule_on_exec_ctx),
|
162
|
+
/*urgent=*/true);
|
148
163
|
}
|
149
164
|
}
|
150
165
|
|
166
|
+
// This callback can be invoked inline while already holding onto the mutex. To
|
167
|
+
// avoid deadlocks, schedule OnReadDone on ExecCtx.
|
168
|
+
void HttpConnectHandshaker::OnReadDoneScheduler(void* arg, grpc_error* error) {
|
169
|
+
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
170
|
+
grpc_core::ExecCtx::Run(
|
171
|
+
DEBUG_LOCATION,
|
172
|
+
GRPC_CLOSURE_INIT(&handshaker->response_read_closure_,
|
173
|
+
&HttpConnectHandshaker::OnReadDone, handshaker,
|
174
|
+
grpc_schedule_on_exec_ctx),
|
175
|
+
GRPC_ERROR_REF(error));
|
176
|
+
}
|
177
|
+
|
151
178
|
// Callback invoked for reading HTTP CONNECT response.
|
152
179
|
void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
|
153
180
|
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
154
|
-
|
155
|
-
gpr_mu_lock(&handshaker->mu_);
|
181
|
+
ReleasableMutexLock lock(&handshaker->mu_);
|
156
182
|
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
|
157
183
|
// If the read failed or we're shutting down, clean up and invoke the
|
158
184
|
// callback with the error.
|
@@ -204,10 +230,12 @@ void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
|
|
204
230
|
// at the Content-Length: header).
|
205
231
|
if (handshaker->http_parser_.state != GRPC_HTTP_BODY) {
|
206
232
|
grpc_slice_buffer_reset_and_unref_internal(handshaker->args_->read_buffer);
|
207
|
-
grpc_endpoint_read(
|
208
|
-
|
209
|
-
|
210
|
-
|
233
|
+
grpc_endpoint_read(
|
234
|
+
handshaker->args_->endpoint, handshaker->args_->read_buffer,
|
235
|
+
GRPC_CLOSURE_INIT(&handshaker->response_read_closure_,
|
236
|
+
&HttpConnectHandshaker::OnReadDoneScheduler,
|
237
|
+
handshaker, grpc_schedule_on_exec_ctx),
|
238
|
+
/*urgent=*/true);
|
211
239
|
return;
|
212
240
|
}
|
213
241
|
// Make sure we got a 2xx response.
|
@@ -222,12 +250,12 @@ void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
|
|
222
250
|
goto done;
|
223
251
|
}
|
224
252
|
// Success. Invoke handshake-done callback.
|
225
|
-
|
253
|
+
ExecCtx::Run(DEBUG_LOCATION, handshaker->on_handshake_done_, error);
|
226
254
|
done:
|
227
255
|
// Set shutdown to true so that subsequent calls to
|
228
256
|
// http_connect_handshaker_shutdown() do nothing.
|
229
257
|
handshaker->is_shutdown_ = true;
|
230
|
-
|
258
|
+
lock.Unlock();
|
231
259
|
handshaker->Unref();
|
232
260
|
}
|
233
261
|
|
@@ -236,17 +264,18 @@ done:
|
|
236
264
|
//
|
237
265
|
|
238
266
|
void HttpConnectHandshaker::Shutdown(grpc_error* why) {
|
239
|
-
|
240
|
-
|
241
|
-
is_shutdown_
|
242
|
-
|
243
|
-
|
267
|
+
{
|
268
|
+
MutexLock lock(&mu_);
|
269
|
+
if (!is_shutdown_) {
|
270
|
+
is_shutdown_ = true;
|
271
|
+
grpc_endpoint_shutdown(args_->endpoint, GRPC_ERROR_REF(why));
|
272
|
+
CleanupArgsForFailureLocked();
|
273
|
+
}
|
244
274
|
}
|
245
|
-
gpr_mu_unlock(&mu_);
|
246
275
|
GRPC_ERROR_UNREF(why);
|
247
276
|
}
|
248
277
|
|
249
|
-
void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* acceptor
|
278
|
+
void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* /*acceptor*/,
|
250
279
|
grpc_closure* on_handshake_done,
|
251
280
|
HandshakerArgs* args) {
|
252
281
|
// Check for HTTP CONNECT channel arg.
|
@@ -257,10 +286,11 @@ void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* acceptor,
|
|
257
286
|
if (server_name == nullptr) {
|
258
287
|
// Set shutdown to true so that subsequent calls to
|
259
288
|
// http_connect_handshaker_shutdown() do nothing.
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
289
|
+
{
|
290
|
+
MutexLock lock(&mu_);
|
291
|
+
is_shutdown_ = true;
|
292
|
+
}
|
293
|
+
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done, GRPC_ERROR_NONE);
|
264
294
|
return;
|
265
295
|
}
|
266
296
|
// Get headers from channel args.
|
@@ -320,17 +350,16 @@ void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* acceptor,
|
|
320
350
|
gpr_free(header_strings);
|
321
351
|
// Take a new ref to be held by the write callback.
|
322
352
|
Ref().release();
|
323
|
-
grpc_endpoint_write(
|
324
|
-
|
353
|
+
grpc_endpoint_write(
|
354
|
+
args->endpoint, &write_buffer_,
|
355
|
+
GRPC_CLOSURE_INIT(&request_done_closure_,
|
356
|
+
&HttpConnectHandshaker::OnWriteDoneScheduler, this,
|
357
|
+
grpc_schedule_on_exec_ctx),
|
358
|
+
nullptr);
|
325
359
|
}
|
326
360
|
|
327
361
|
HttpConnectHandshaker::HttpConnectHandshaker() {
|
328
|
-
gpr_mu_init(&mu_);
|
329
362
|
grpc_slice_buffer_init(&write_buffer_);
|
330
|
-
GRPC_CLOSURE_INIT(&request_done_closure_, &HttpConnectHandshaker::OnWriteDone,
|
331
|
-
this, grpc_schedule_on_exec_ctx);
|
332
|
-
GRPC_CLOSURE_INIT(&response_read_closure_, &HttpConnectHandshaker::OnReadDone,
|
333
|
-
this, grpc_schedule_on_exec_ctx);
|
334
363
|
grpc_http_parser_init(&http_parser_, GRPC_HTTP_RESPONSE, &http_response_);
|
335
364
|
}
|
336
365
|
|
@@ -340,8 +369,8 @@ HttpConnectHandshaker::HttpConnectHandshaker() {
|
|
340
369
|
|
341
370
|
class HttpConnectHandshakerFactory : public HandshakerFactory {
|
342
371
|
public:
|
343
|
-
void AddHandshakers(const grpc_channel_args* args
|
344
|
-
grpc_pollset_set* interested_parties
|
372
|
+
void AddHandshakers(const grpc_channel_args* /*args*/,
|
373
|
+
grpc_pollset_set* /*interested_parties*/,
|
345
374
|
HandshakeManager* handshake_mgr) override {
|
346
375
|
handshake_mgr->Add(MakeRefCounted<HttpConnectHandshaker>());
|
347
376
|
}
|