grpc 1.4.5 → 1.6.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 +1235 -1100
- data/etc/roots.pem +0 -412
- data/include/grpc/byte_buffer.h +10 -25
- data/include/grpc/byte_buffer_reader.h +10 -25
- data/include/grpc/census.h +10 -25
- data/include/grpc/compression.h +10 -25
- data/include/grpc/grpc.h +15 -26
- data/include/grpc/grpc_cronet.h +10 -25
- data/include/grpc/grpc_posix.h +10 -25
- data/include/grpc/grpc_security.h +10 -25
- data/include/grpc/grpc_security_constants.h +10 -25
- data/include/grpc/impl/codegen/atm.h +11 -25
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +10 -25
- data/include/grpc/impl/codegen/atm_gcc_sync.h +10 -25
- data/include/grpc/impl/codegen/atm_windows.h +10 -25
- data/include/grpc/impl/codegen/byte_buffer_reader.h +11 -26
- data/include/grpc/impl/codegen/compression_types.h +12 -27
- data/include/grpc/impl/codegen/connectivity_state.h +10 -25
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +10 -25
- data/include/grpc/impl/codegen/gpr_slice.h +10 -25
- data/include/grpc/impl/codegen/gpr_types.h +10 -25
- data/include/grpc/impl/codegen/grpc_types.h +42 -43
- data/include/grpc/impl/codegen/port_platform.h +10 -25
- data/include/grpc/impl/codegen/propagation_bits.h +10 -25
- data/include/grpc/impl/codegen/slice.h +13 -28
- data/include/grpc/impl/codegen/status.h +10 -25
- data/include/grpc/impl/codegen/sync.h +10 -25
- data/include/grpc/impl/codegen/sync_generic.h +10 -25
- data/include/grpc/impl/codegen/sync_posix.h +10 -25
- data/include/grpc/impl/codegen/sync_windows.h +10 -25
- data/include/grpc/load_reporting.h +10 -25
- data/include/grpc/slice.h +10 -25
- data/include/grpc/slice_buffer.h +10 -25
- data/include/grpc/status.h +10 -25
- data/include/grpc/support/alloc.h +10 -25
- data/include/grpc/support/atm.h +10 -25
- data/include/grpc/support/atm_gcc_atomic.h +10 -25
- data/include/grpc/support/atm_gcc_sync.h +10 -25
- data/include/grpc/support/atm_windows.h +10 -25
- data/include/grpc/support/avl.h +46 -49
- data/include/grpc/support/cmdline.h +10 -25
- data/include/grpc/support/cpu.h +10 -25
- data/include/grpc/support/histogram.h +10 -25
- data/include/grpc/support/host_port.h +10 -25
- data/include/grpc/support/log.h +10 -25
- data/include/grpc/support/log_windows.h +10 -25
- data/include/grpc/support/port_platform.h +10 -25
- data/include/grpc/support/string_util.h +10 -25
- data/include/grpc/support/subprocess.h +10 -25
- data/include/grpc/support/sync.h +10 -25
- data/include/grpc/support/sync_generic.h +10 -25
- data/include/grpc/support/sync_posix.h +10 -25
- data/include/grpc/support/sync_windows.h +10 -25
- data/include/grpc/support/thd.h +10 -25
- data/include/grpc/support/time.h +10 -25
- data/include/grpc/support/tls.h +10 -25
- data/include/grpc/support/tls_gcc.h +10 -25
- data/include/grpc/support/tls_msvc.h +10 -25
- data/include/grpc/support/tls_pthread.h +10 -25
- data/include/grpc/support/useful.h +10 -25
- data/include/grpc/support/workaround_list.h +11 -26
- data/src/boringssl/err_data.c +277 -259
- data/src/core/ext/census/aggregation.h +10 -25
- data/src/core/ext/census/base_resources.c +10 -25
- data/src/core/ext/census/base_resources.h +10 -25
- data/src/core/ext/census/census_interface.h +10 -25
- data/src/core/ext/census/census_rpc_stats.h +10 -25
- data/src/core/ext/census/context.c +10 -25
- data/src/core/ext/census/gen/census.pb.c +10 -25
- data/src/core/ext/census/gen/census.pb.h +10 -25
- data/src/core/ext/census/gen/trace_context.pb.c +10 -25
- data/src/core/ext/census/gen/trace_context.pb.h +10 -25
- data/src/core/ext/census/grpc_context.c +10 -25
- data/src/core/ext/census/grpc_filter.c +11 -26
- data/src/core/ext/census/grpc_filter.h +10 -25
- data/src/core/ext/census/grpc_plugin.c +10 -25
- data/src/core/ext/census/initialize.c +10 -25
- data/src/core/ext/census/intrusive_hash_map.c +10 -25
- data/src/core/ext/census/intrusive_hash_map.h +10 -25
- data/src/core/ext/census/intrusive_hash_map_internal.h +10 -25
- data/src/core/ext/census/mlog.c +10 -25
- data/src/core/ext/census/mlog.h +10 -25
- data/src/core/ext/census/operation.c +10 -25
- data/src/core/ext/census/placeholders.c +10 -25
- data/src/core/ext/census/resource.c +10 -25
- data/src/core/ext/census/resource.h +10 -25
- data/src/core/ext/census/rpc_metric_id.h +10 -25
- data/src/core/ext/census/trace_context.c +10 -25
- data/src/core/ext/census/trace_context.h +10 -25
- data/src/core/ext/census/trace_label.h +10 -25
- data/src/core/ext/census/trace_propagation.h +10 -25
- data/src/core/ext/census/trace_status.h +10 -25
- data/src/core/ext/census/trace_string.h +10 -25
- data/src/core/ext/census/tracing.c +10 -26
- data/src/core/ext/census/tracing.h +10 -25
- data/src/core/ext/filters/client_channel/channel_connectivity.c +20 -33
- data/src/core/ext/filters/client_channel/client_channel.c +617 -520
- data/src/core/ext/filters/client_channel/client_channel.h +15 -28
- data/src/core/ext/filters/client_channel/client_channel_factory.c +13 -31
- data/src/core/ext/filters/client_channel/client_channel_factory.h +10 -25
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +16 -29
- data/src/core/ext/filters/client_channel/connector.c +10 -25
- data/src/core/ext/filters/client_channel/connector.h +10 -25
- data/src/core/ext/filters/client_channel/http_connect_handshaker.c +15 -30
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -25
- data/src/core/ext/filters/client_channel/http_proxy.c +112 -38
- data/src/core/ext/filters/client_channel/http_proxy.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy.c +32 -36
- data/src/core/ext/filters/client_channel/lb_policy.h +24 -27
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +14 -30
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +464 -279
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +10 -25
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +15 -28
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +40 -48
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +65 -49
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +31 -31
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +11 -26
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +13 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +27 -21
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +373 -136
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +504 -279
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +12 -31
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +12 -27
- data/src/core/ext/filters/client_channel/lb_policy_registry.c +10 -25
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -25
- data/src/core/ext/filters/client_channel/parse_address.c +10 -25
- data/src/core/ext/filters/client_channel/parse_address.h +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper.c +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper.h +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +10 -25
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +10 -25
- data/src/core/ext/filters/client_channel/resolver.c +33 -38
- data/src/core/ext/filters/client_channel/resolver.h +19 -30
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +153 -50
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +14 -27
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +33 -30
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +326 -116
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +35 -36
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +60 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +19 -34
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +254 -0
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +60 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +16 -28
- data/src/core/ext/filters/client_channel/resolver_factory.c +10 -25
- data/src/core/ext/filters/client_channel/resolver_factory.h +10 -25
- data/src/core/ext/filters/client_channel/resolver_registry.c +10 -25
- data/src/core/ext/filters/client_channel/resolver_registry.h +10 -25
- data/src/core/ext/filters/client_channel/retry_throttle.c +23 -34
- data/src/core/ext/filters/client_channel/retry_throttle.h +10 -25
- data/src/core/ext/filters/client_channel/subchannel.c +33 -55
- data/src/core/ext/filters/client_channel/subchannel.h +16 -26
- data/src/core/ext/filters/client_channel/subchannel_index.c +55 -92
- data/src/core/ext/filters/client_channel/subchannel_index.h +26 -29
- data/src/core/ext/filters/client_channel/uri_parser.c +10 -25
- data/src/core/ext/filters/client_channel/uri_parser.h +10 -25
- data/src/core/ext/filters/deadline/deadline_filter.c +30 -45
- data/src/core/ext/filters/deadline/deadline_filter.h +10 -25
- data/src/core/ext/filters/http/client/http_client_filter.c +255 -294
- data/src/core/ext/filters/http/client/http_client_filter.h +10 -25
- data/src/core/ext/filters/http/http_filters_plugin.c +11 -26
- data/src/core/ext/filters/http/message_compress/message_compress_filter.c +133 -105
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +10 -25
- data/src/core/ext/filters/http/server/http_server_filter.c +17 -32
- data/src/core/ext/filters/http/server/http_server_filter.h +10 -25
- data/src/core/ext/filters/load_reporting/load_reporting.c +11 -30
- data/src/core/ext/filters/load_reporting/load_reporting.h +10 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +11 -26
- data/src/core/ext/filters/load_reporting/load_reporting_filter.h +10 -25
- data/src/core/ext/filters/max_age/max_age_filter.c +28 -43
- data/src/core/ext/filters/max_age/max_age_filter.h +10 -25
- data/src/core/ext/filters/message_size/message_size_filter.c +24 -37
- data/src/core/ext/filters/message_size/message_size_filter.h +10 -25
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +16 -31
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +10 -25
- data/src/core/ext/filters/workarounds/workaround_utils.c +12 -26
- data/src/core/ext/filters/workarounds/workaround_utils.h +11 -26
- data/src/core/ext/transport/chttp2/alpn/alpn.c +10 -25
- data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -25
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +13 -28
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +10 -25
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +13 -30
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +12 -29
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +13 -30
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +11 -26
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -25
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +10 -25
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +10 -25
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +11 -25
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +10 -25
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +10 -25
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +15 -27
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +421 -443
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -25
- data/src/core/ext/transport/chttp2/transport/flow_control.c +500 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_data.c +20 -28
- data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +11 -26
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +11 -26
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +16 -29
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +10 -25
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -33
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +18 -31
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +12 -25
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +15 -30
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +10 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -25
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +10 -25
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -25
- data/src/core/ext/transport/chttp2/transport/huffsyms.c +10 -25
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +10 -25
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +10 -25
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +10 -25
- data/src/core/ext/transport/chttp2/transport/internal.h +191 -179
- data/src/core/ext/transport/chttp2/transport/parsing.c +33 -102
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +26 -28
- data/src/core/ext/transport/chttp2/transport/stream_map.c +10 -25
- data/src/core/ext/transport/chttp2/transport/stream_map.h +10 -25
- data/src/core/ext/transport/chttp2/transport/varint.c +14 -25
- data/src/core/ext/transport/chttp2/transport/varint.h +10 -25
- data/src/core/ext/transport/chttp2/transport/writing.c +164 -106
- data/src/core/ext/transport/inproc/inproc_plugin.c +29 -0
- data/src/core/ext/transport/inproc/inproc_transport.c +1303 -0
- data/src/core/ext/transport/inproc/inproc_transport.h +41 -0
- data/src/core/lib/channel/channel_args.c +52 -27
- data/src/core/lib/channel/channel_args.h +18 -27
- data/src/core/lib/channel/channel_stack.c +11 -26
- data/src/core/lib/channel/channel_stack.h +12 -27
- data/src/core/lib/channel/channel_stack_builder.c +11 -26
- data/src/core/lib/channel/channel_stack_builder.h +10 -25
- data/src/core/lib/channel/connected_channel.c +10 -25
- data/src/core/lib/channel/connected_channel.h +10 -25
- data/src/core/lib/channel/context.h +10 -25
- data/src/core/lib/channel/handshaker.c +14 -29
- data/src/core/lib/channel/handshaker.h +10 -25
- data/src/core/lib/channel/handshaker_factory.c +10 -25
- data/src/core/lib/channel/handshaker_factory.h +10 -25
- data/src/core/lib/channel/handshaker_registry.c +10 -25
- data/src/core/lib/channel/handshaker_registry.h +10 -25
- data/src/core/lib/compression/algorithm_metadata.h +10 -25
- data/src/core/lib/compression/compression.c +10 -25
- data/src/core/lib/compression/message_compress.c +10 -25
- data/src/core/lib/compression/message_compress.h +10 -25
- data/src/core/lib/compression/stream_compression.c +191 -0
- data/src/core/lib/compression/stream_compression.h +90 -0
- data/src/core/lib/debug/trace.c +28 -29
- data/src/core/lib/debug/trace.h +16 -30
- data/src/core/lib/http/format_request.c +10 -25
- data/src/core/lib/http/format_request.h +10 -25
- data/src/core/lib/http/httpcli.c +19 -35
- data/src/core/lib/http/httpcli.h +10 -25
- data/src/core/lib/http/httpcli_security_connector.c +17 -30
- data/src/core/lib/http/parser.c +11 -26
- data/src/core/lib/http/parser.h +10 -25
- data/src/core/lib/iomgr/closure.c +62 -25
- data/src/core/lib/iomgr/closure.h +81 -26
- data/src/core/lib/iomgr/combiner.c +103 -200
- data/src/core/lib/iomgr/combiner.h +14 -32
- data/src/core/lib/iomgr/endpoint.c +10 -29
- data/src/core/lib/iomgr/endpoint.h +10 -29
- data/src/core/lib/iomgr/endpoint_pair.h +10 -25
- data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -25
- data/src/core/lib/iomgr/endpoint_pair_uv.c +10 -25
- data/src/core/lib/iomgr/endpoint_pair_windows.c +10 -25
- data/src/core/lib/iomgr/error.c +45 -46
- data/src/core/lib/iomgr/error.h +21 -34
- data/src/core/lib/iomgr/error_internal.h +10 -25
- data/src/core/lib/iomgr/ev_epoll1_linux.c +279 -179
- data/src/core/lib/iomgr/ev_epoll1_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +75 -264
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +44 -199
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epollex_linux.c +184 -247
- data/src/core/lib/iomgr/ev_epollex_linux.h +10 -25
- data/src/core/lib/iomgr/ev_epollsig_linux.c +116 -323
- data/src/core/lib/iomgr/ev_epollsig_linux.h +10 -25
- data/src/core/lib/iomgr/ev_poll_posix.c +328 -184
- data/src/core/lib/iomgr/ev_poll_posix.h +10 -25
- data/src/core/lib/iomgr/ev_posix.c +25 -56
- data/src/core/lib/iomgr/ev_posix.h +15 -44
- data/src/core/lib/iomgr/ev_windows.c +11 -26
- data/src/core/lib/iomgr/exec_ctx.c +36 -45
- data/src/core/lib/iomgr/exec_ctx.h +10 -25
- data/src/core/lib/iomgr/executor.c +152 -127
- data/src/core/lib/iomgr/executor.h +18 -26
- data/src/core/lib/iomgr/gethostname.h +26 -0
- data/src/core/lib/iomgr/gethostname_fallback.c +27 -0
- data/src/core/lib/iomgr/gethostname_host_name_max.c +37 -0
- data/src/core/lib/iomgr/gethostname_sysconf.c +37 -0
- data/src/core/lib/iomgr/iocp_windows.c +10 -25
- data/src/core/lib/iomgr/iocp_windows.h +10 -25
- data/src/core/lib/iomgr/iomgr.c +17 -28
- data/src/core/lib/iomgr/iomgr.h +12 -27
- data/src/core/lib/iomgr/iomgr_internal.h +10 -25
- data/src/core/lib/iomgr/iomgr_posix.c +11 -26
- data/src/core/lib/iomgr/iomgr_posix.h +10 -25
- data/src/core/lib/iomgr/iomgr_uv.c +19 -26
- data/src/core/lib/iomgr/iomgr_uv.h +37 -0
- data/src/core/lib/iomgr/iomgr_windows.c +10 -25
- data/src/core/lib/iomgr/is_epollexclusive_available.c +10 -25
- data/src/core/lib/iomgr/is_epollexclusive_available.h +10 -25
- data/src/core/lib/iomgr/load_file.c +10 -25
- data/src/core/lib/iomgr/load_file.h +10 -25
- data/src/core/lib/iomgr/lockfree_event.c +22 -35
- data/src/core/lib/iomgr/lockfree_event.h +13 -27
- data/src/core/lib/iomgr/nameser.h +104 -0
- data/src/core/lib/iomgr/network_status_tracker.c +10 -25
- data/src/core/lib/iomgr/network_status_tracker.h +10 -25
- data/src/core/lib/iomgr/polling_entity.c +10 -25
- data/src/core/lib/iomgr/polling_entity.h +14 -34
- data/src/core/lib/iomgr/pollset.h +14 -25
- data/src/core/lib/iomgr/pollset_set.h +10 -25
- data/src/core/lib/iomgr/pollset_set_uv.c +10 -25
- data/src/core/lib/iomgr/pollset_set_windows.c +10 -25
- data/src/core/lib/iomgr/pollset_set_windows.h +10 -25
- data/src/core/lib/iomgr/pollset_uv.c +25 -26
- data/src/core/lib/iomgr/pollset_uv.h +10 -25
- data/src/core/lib/iomgr/pollset_windows.c +17 -27
- data/src/core/lib/iomgr/pollset_windows.h +10 -25
- data/src/core/lib/iomgr/port.h +24 -25
- data/src/core/lib/iomgr/resolve_address.h +10 -25
- data/src/core/lib/iomgr/resolve_address_posix.c +13 -28
- data/src/core/lib/iomgr/resolve_address_uv.c +31 -35
- data/src/core/lib/iomgr/resolve_address_windows.c +13 -28
- data/src/core/lib/iomgr/resource_quota.c +52 -67
- data/src/core/lib/iomgr/resource_quota.h +10 -25
- data/src/core/lib/iomgr/sockaddr.h +10 -25
- data/src/core/lib/iomgr/sockaddr_posix.h +10 -25
- data/src/core/lib/iomgr/sockaddr_utils.c +15 -25
- data/src/core/lib/iomgr/sockaddr_utils.h +12 -25
- data/src/core/lib/iomgr/sockaddr_windows.h +10 -25
- data/src/core/lib/iomgr/socket_factory_posix.c +13 -31
- data/src/core/lib/iomgr/socket_factory_posix.h +10 -25
- data/src/core/lib/iomgr/socket_mutator.c +14 -31
- data/src/core/lib/iomgr/socket_mutator.h +10 -25
- data/src/core/lib/iomgr/socket_utils.h +10 -25
- data/src/core/lib/iomgr/socket_utils_common_posix.c +10 -25
- data/src/core/lib/iomgr/socket_utils_linux.c +10 -25
- data/src/core/lib/iomgr/socket_utils_posix.c +10 -25
- data/src/core/lib/iomgr/socket_utils_posix.h +10 -25
- data/src/core/lib/iomgr/socket_utils_uv.c +10 -25
- data/src/core/lib/iomgr/socket_utils_windows.c +10 -25
- data/src/core/lib/iomgr/socket_windows.c +12 -27
- data/src/core/lib/iomgr/socket_windows.h +10 -25
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +10 -25
- data/src/core/lib/iomgr/tcp_client.h +10 -25
- data/src/core/lib/iomgr/tcp_client_posix.c +21 -34
- data/src/core/lib/iomgr/tcp_client_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_client_uv.c +18 -27
- data/src/core/lib/iomgr/tcp_client_windows.c +14 -29
- data/src/core/lib/iomgr/tcp_posix.c +36 -55
- data/src/core/lib/iomgr/tcp_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_server.h +10 -25
- data/src/core/lib/iomgr/tcp_server_posix.c +16 -31
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +10 -25
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +11 -26
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +10 -25
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +10 -25
- data/src/core/lib/iomgr/tcp_server_uv.c +103 -64
- data/src/core/lib/iomgr/tcp_server_windows.c +14 -29
- data/src/core/lib/iomgr/tcp_uv.c +41 -45
- data/src/core/lib/iomgr/tcp_uv.h +10 -25
- data/src/core/lib/iomgr/tcp_windows.c +39 -53
- data/src/core/lib/iomgr/tcp_windows.h +10 -25
- data/src/core/lib/iomgr/time_averaged_stats.c +10 -25
- data/src/core/lib/iomgr/time_averaged_stats.h +10 -25
- data/src/core/lib/iomgr/timer.h +18 -27
- data/src/core/lib/iomgr/timer_generic.c +91 -87
- data/src/core/lib/iomgr/timer_generic.h +10 -25
- data/src/core/lib/iomgr/timer_heap.c +10 -25
- data/src/core/lib/iomgr/timer_heap.h +10 -25
- data/src/core/lib/iomgr/timer_manager.c +178 -100
- data/src/core/lib/iomgr/timer_manager.h +10 -25
- data/src/core/lib/iomgr/timer_uv.c +23 -33
- data/src/core/lib/iomgr/timer_uv.h +10 -25
- data/src/core/lib/iomgr/udp_server.c +17 -32
- data/src/core/lib/iomgr/udp_server.h +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix.c +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix.h +10 -25
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_cv.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_cv.h +13 -28
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_nospecial.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +10 -25
- data/src/core/lib/iomgr/wakeup_fd_posix.c +10 -25
- data/src/core/lib/iomgr/wakeup_fd_posix.h +10 -25
- data/src/core/lib/json/json.c +10 -25
- data/src/core/lib/json/json.h +10 -25
- data/src/core/lib/json/json_common.h +10 -25
- data/src/core/lib/json/json_reader.c +11 -25
- data/src/core/lib/json/json_reader.h +10 -25
- data/src/core/lib/json/json_string.c +10 -25
- data/src/core/lib/json/json_writer.c +10 -25
- data/src/core/lib/json/json_writer.h +10 -25
- data/src/core/lib/profiling/basic_timers.c +10 -25
- data/src/core/lib/profiling/stap_timers.c +10 -25
- data/src/core/lib/profiling/timers.h +10 -25
- data/src/core/lib/security/context/security_context.c +32 -40
- data/src/core/lib/security/context/security_context.h +15 -26
- data/src/core/lib/security/credentials/composite/composite_credentials.c +76 -81
- data/src/core/lib/security/credentials/composite/composite_credentials.h +10 -25
- data/src/core/lib/security/credentials/credentials.c +29 -49
- data/src/core/lib/security/credentials/credentials.h +48 -61
- data/src/core/lib/security/credentials/credentials_metadata.c +34 -78
- data/src/core/lib/security/credentials/fake/fake_credentials.c +33 -56
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -27
- data/src/core/lib/security/credentials/google_default/credentials_generic.c +10 -25
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +12 -27
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +10 -25
- data/src/core/lib/security/credentials/iam/iam_credentials.c +40 -40
- data/src/core/lib/security/credentials/iam/iam_credentials.h +11 -26
- data/src/core/lib/security/credentials/jwt/json_token.c +10 -25
- data/src/core/lib/security/credentials/jwt/json_token.h +10 -25
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +45 -48
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -26
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +53 -33
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +10 -25
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +155 -87
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +24 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +118 -82
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +24 -27
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -32
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -25
- data/src/core/lib/security/transport/auth_filters.h +10 -25
- data/src/core/lib/security/transport/client_auth_filter.c +217 -112
- data/src/core/lib/security/transport/lb_targets_info.c +16 -32
- data/src/core/lib/security/transport/lb_targets_info.h +10 -25
- data/src/core/lib/security/transport/secure_endpoint.c +29 -43
- data/src/core/lib/security/transport/secure_endpoint.h +10 -25
- data/src/core/lib/security/transport/security_connector.c +80 -61
- data/src/core/lib/security/transport/security_connector.h +35 -35
- data/src/core/lib/security/transport/security_handshaker.c +18 -33
- data/src/core/lib/security/transport/security_handshaker.h +10 -25
- data/src/core/lib/security/transport/server_auth_filter.c +62 -116
- data/src/core/lib/security/transport/tsi_error.c +10 -25
- data/src/core/lib/security/transport/tsi_error.h +10 -25
- data/src/core/lib/security/util/json_util.c +10 -25
- data/src/core/lib/security/util/json_util.h +10 -25
- data/src/core/lib/slice/b64.c +10 -25
- data/src/core/lib/slice/b64.h +10 -25
- data/src/core/lib/slice/percent_encoding.c +10 -25
- data/src/core/lib/slice/percent_encoding.h +10 -25
- data/src/core/lib/slice/slice.c +10 -25
- data/src/core/lib/slice/slice_buffer.c +10 -25
- data/src/core/lib/slice/slice_hash_table.c +48 -26
- data/src/core/lib/slice/slice_hash_table.h +26 -28
- data/src/core/lib/slice/slice_intern.c +10 -25
- data/src/core/lib/slice/slice_internal.h +10 -25
- data/src/core/lib/slice/slice_string_helpers.c +10 -25
- data/src/core/lib/slice/slice_string_helpers.h +10 -25
- data/src/core/lib/support/alloc.c +10 -25
- data/src/core/lib/support/arena.c +12 -27
- data/src/core/lib/support/arena.h +10 -25
- data/src/core/lib/support/atm.c +17 -32
- data/src/core/lib/support/atomic.h +10 -25
- data/src/core/lib/support/atomic_with_atm.h +10 -25
- data/src/core/lib/support/atomic_with_std.h +10 -25
- data/src/core/lib/support/avl.c +101 -101
- data/src/core/lib/support/backoff.c +10 -25
- data/src/core/lib/support/backoff.h +10 -25
- data/src/core/lib/support/block_annotate.h +10 -25
- data/src/core/lib/support/cmdline.c +10 -25
- data/src/core/lib/support/cpu_iphone.c +10 -25
- data/src/core/lib/support/cpu_linux.c +10 -25
- data/src/core/lib/support/cpu_posix.c +10 -25
- data/src/core/lib/support/cpu_windows.c +10 -25
- data/src/core/lib/support/env.h +16 -25
- data/src/core/lib/support/env_linux.c +30 -37
- data/src/core/lib/support/env_posix.c +15 -25
- data/src/core/lib/support/env_windows.c +15 -25
- data/src/core/lib/support/histogram.c +10 -25
- data/src/core/lib/support/host_port.c +10 -25
- data/src/core/lib/support/log.c +20 -29
- data/src/core/lib/support/log_android.c +10 -25
- data/src/core/lib/support/log_linux.c +13 -26
- data/src/core/lib/support/log_posix.c +10 -25
- data/src/core/lib/support/log_windows.c +10 -25
- data/src/core/lib/support/memory.h +10 -25
- data/src/core/lib/support/mpscq.c +11 -49
- data/src/core/lib/support/mpscq.h +11 -50
- data/src/core/lib/support/murmur_hash.c +12 -25
- data/src/core/lib/support/murmur_hash.h +10 -25
- data/src/core/lib/support/spinlock.h +10 -25
- data/src/core/lib/support/stack_lockfree.c +10 -25
- data/src/core/lib/support/stack_lockfree.h +10 -25
- data/src/core/lib/support/string.c +10 -25
- data/src/core/lib/support/string.h +10 -25
- data/src/core/lib/support/string_posix.c +10 -25
- data/src/core/lib/support/string_util_windows.c +10 -25
- data/src/core/lib/support/string_windows.c +10 -25
- data/src/core/lib/support/string_windows.h +10 -25
- data/src/core/lib/support/subprocess_posix.c +10 -25
- data/src/core/lib/support/subprocess_windows.c +10 -25
- data/src/core/lib/support/sync.c +10 -25
- data/src/core/lib/support/sync_posix.c +10 -25
- data/src/core/lib/support/sync_windows.c +10 -25
- data/src/core/lib/support/thd.c +10 -25
- data/src/core/lib/support/thd_internal.h +10 -25
- data/src/core/lib/support/thd_posix.c +10 -25
- data/src/core/lib/support/thd_windows.c +10 -25
- data/src/core/lib/support/time.c +10 -25
- data/src/core/lib/support/time_posix.c +10 -25
- data/src/core/lib/support/time_precise.c +18 -33
- data/src/core/lib/support/time_precise.h +10 -25
- data/src/core/lib/support/time_windows.c +10 -25
- data/src/core/lib/support/tls_pthread.c +10 -25
- data/src/core/lib/support/tmpfile.h +10 -25
- data/src/core/lib/support/tmpfile_msys.c +10 -25
- data/src/core/lib/support/tmpfile_posix.c +10 -25
- data/src/core/lib/support/tmpfile_windows.c +10 -25
- data/src/core/lib/support/wrap_memcpy.c +10 -25
- data/src/core/lib/surface/alarm.c +78 -35
- data/src/core/lib/surface/alarm_internal.h +40 -0
- data/src/core/lib/surface/api_trace.c +11 -26
- data/src/core/lib/surface/api_trace.h +10 -25
- data/src/core/lib/surface/byte_buffer.c +10 -25
- data/src/core/lib/surface/byte_buffer_reader.c +10 -25
- data/src/core/lib/surface/call.c +64 -84
- data/src/core/lib/surface/call.h +11 -26
- data/src/core/lib/surface/call_details.c +10 -25
- data/src/core/lib/surface/call_log_batch.c +10 -25
- data/src/core/lib/surface/call_test_only.h +10 -25
- data/src/core/lib/surface/channel.c +11 -26
- data/src/core/lib/surface/channel.h +11 -26
- data/src/core/lib/surface/channel_init.c +10 -25
- data/src/core/lib/surface/channel_init.h +10 -25
- data/src/core/lib/surface/channel_ping.c +12 -27
- data/src/core/lib/surface/channel_stack_type.c +10 -25
- data/src/core/lib/surface/channel_stack_type.h +10 -25
- data/src/core/lib/surface/completion_queue.c +442 -331
- data/src/core/lib/surface/completion_queue.h +16 -33
- data/src/core/lib/surface/completion_queue_factory.c +10 -25
- data/src/core/lib/surface/completion_queue_factory.h +10 -25
- data/src/core/lib/surface/event_string.c +10 -25
- data/src/core/lib/surface/event_string.h +10 -25
- data/src/core/lib/surface/init.c +38 -47
- data/src/core/lib/surface/init.h +10 -25
- data/src/core/lib/surface/init_secure.c +20 -27
- data/src/core/lib/surface/lame_client.cc +14 -29
- data/src/core/lib/surface/lame_client.h +10 -25
- data/src/core/lib/surface/metadata_array.c +10 -25
- data/src/core/lib/surface/server.c +128 -81
- data/src/core/lib/surface/server.h +10 -25
- data/src/core/lib/surface/validate_metadata.c +10 -25
- data/src/core/lib/surface/validate_metadata.h +10 -25
- data/src/core/lib/surface/version.c +11 -26
- data/src/core/lib/transport/bdp_estimator.c +19 -29
- data/src/core/lib/transport/bdp_estimator.h +16 -29
- data/src/core/lib/transport/byte_stream.c +127 -36
- data/src/core/lib/transport/byte_stream.h +88 -46
- data/src/core/lib/transport/connectivity_state.c +17 -31
- data/src/core/lib/transport/connectivity_state.h +10 -25
- data/src/core/lib/transport/error_utils.c +10 -25
- data/src/core/lib/transport/error_utils.h +10 -25
- data/src/core/lib/transport/http2_errors.h +10 -25
- data/src/core/lib/transport/metadata.c +87 -85
- data/src/core/lib/transport/metadata.h +15 -28
- data/src/core/lib/transport/metadata_batch.c +10 -25
- data/src/core/lib/transport/metadata_batch.h +10 -25
- data/src/core/lib/transport/pid_controller.c +10 -25
- data/src/core/lib/transport/pid_controller.h +10 -25
- data/src/core/lib/transport/service_config.c +11 -26
- data/src/core/lib/transport/service_config.h +10 -25
- data/src/core/lib/transport/static_metadata.c +12 -26
- data/src/core/lib/transport/static_metadata.h +10 -25
- data/src/core/lib/transport/status_conversion.c +10 -25
- data/src/core/lib/transport/status_conversion.h +10 -25
- data/src/core/lib/transport/timeout_encoding.c +10 -25
- data/src/core/lib/transport/timeout_encoding.h +10 -25
- data/src/core/lib/transport/transport.c +60 -53
- data/src/core/lib/transport/transport.h +36 -34
- data/src/core/lib/transport/transport_impl.h +10 -25
- data/src/core/lib/transport/transport_op_string.c +10 -28
- data/src/core/plugin_registry/grpc_plugin_registry.c +22 -25
- data/src/core/tsi/fake_transport_security.c +199 -94
- data/src/core/tsi/fake_transport_security.h +11 -26
- data/src/core/tsi/gts_transport_security.c +40 -0
- data/src/core/tsi/gts_transport_security.h +37 -0
- data/src/core/tsi/ssl_transport_security.c +13 -32
- data/src/core/tsi/ssl_transport_security.h +10 -25
- data/src/core/tsi/ssl_types.h +10 -25
- data/src/core/tsi/transport_security.c +48 -78
- data/src/core/tsi/transport_security.h +18 -27
- data/src/core/tsi/transport_security_adapter.c +17 -29
- data/src/core/tsi/transport_security_adapter.h +10 -25
- data/src/core/tsi/transport_security_grpc.c +64 -0
- data/src/core/tsi/transport_security_grpc.h +80 -0
- data/src/core/tsi/transport_security_interface.h +21 -27
- data/src/ruby/bin/apis/google/protobuf/empty.rb +10 -25
- data/src/ruby/bin/apis/pubsub_demo.rb +10 -25
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +10 -25
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +10 -25
- data/src/ruby/bin/math_client.rb +10 -25
- data/src/ruby/bin/math_server.rb +10 -25
- data/src/ruby/bin/math_services_pb.rb +10 -25
- data/src/ruby/bin/noproto_client.rb +10 -25
- data/src/ruby/bin/noproto_server.rb +10 -25
- data/src/ruby/ext/grpc/extconf.rb +10 -25
- data/src/ruby/ext/grpc/rb_byte_buffer.c +10 -25
- data/src/ruby/ext/grpc/rb_byte_buffer.h +10 -25
- data/src/ruby/ext/grpc/rb_call.c +44 -25
- data/src/ruby/ext/grpc/rb_call.h +10 -25
- data/src/ruby/ext/grpc/rb_call_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_call_credentials.h +10 -25
- data/src/ruby/ext/grpc/rb_channel.c +10 -25
- data/src/ruby/ext/grpc/rb_channel.h +10 -25
- data/src/ruby/ext/grpc/rb_channel_args.c +10 -25
- data/src/ruby/ext/grpc/rb_channel_args.h +10 -25
- data/src/ruby/ext/grpc/rb_channel_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_channel_credentials.h +10 -25
- data/src/ruby/ext/grpc/rb_completion_queue.c +10 -25
- data/src/ruby/ext/grpc/rb_completion_queue.h +10 -25
- data/src/ruby/ext/grpc/rb_compression_options.c +10 -25
- data/src/ruby/ext/grpc/rb_compression_options.h +10 -25
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -25
- data/src/ruby/ext/grpc/rb_event_thread.h +10 -25
- data/src/ruby/ext/grpc/rb_grpc.c +10 -25
- data/src/ruby/ext/grpc/rb_grpc.h +10 -25
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -25
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +16 -31
- data/src/ruby/ext/grpc/rb_loader.c +10 -25
- data/src/ruby/ext/grpc/rb_loader.h +10 -25
- data/src/ruby/ext/grpc/rb_server.c +10 -25
- data/src/ruby/ext/grpc/rb_server.h +10 -25
- data/src/ruby/ext/grpc/rb_server_credentials.c +10 -25
- data/src/ruby/ext/grpc/rb_server_credentials.h +10 -25
- data/src/ruby/lib/grpc.rb +10 -25
- data/src/ruby/lib/grpc/core/time_consts.rb +10 -25
- data/src/ruby/lib/grpc/errors.rb +16 -30
- data/src/ruby/lib/grpc/generic/active_call.rb +25 -27
- data/src/ruby/lib/grpc/generic/bidi_call.rb +17 -27
- data/src/ruby/lib/grpc/generic/client_stub.rb +10 -25
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +10 -25
- data/src/ruby/lib/grpc/generic/rpc_server.rb +10 -25
- data/src/ruby/lib/grpc/generic/service.rb +10 -25
- data/src/ruby/lib/grpc/grpc.rb +10 -25
- data/src/ruby/lib/grpc/logconfig.rb +10 -25
- data/src/ruby/lib/grpc/notifier.rb +10 -25
- data/src/ruby/lib/grpc/version.rb +11 -26
- data/src/ruby/pb/generate_proto_ruby.sh +10 -25
- data/src/ruby/pb/grpc/health/checker.rb +10 -25
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +10 -25
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +10 -25
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +10 -25
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +10 -25
- data/src/ruby/pb/test/client.rb +10 -25
- data/src/ruby/pb/test/server.rb +10 -25
- data/src/ruby/spec/call_credentials_spec.rb +10 -25
- data/src/ruby/spec/call_spec.rb +43 -25
- data/src/ruby/spec/channel_connection_spec.rb +10 -25
- data/src/ruby/spec/channel_credentials_spec.rb +11 -26
- data/src/ruby/spec/channel_spec.rb +10 -25
- data/src/ruby/spec/client_auth_spec.rb +10 -25
- data/src/ruby/spec/client_server_spec.rb +66 -25
- data/src/ruby/spec/compression_options_spec.rb +10 -25
- data/src/ruby/spec/error_sanity_spec.rb +10 -25
- data/src/ruby/spec/generic/active_call_spec.rb +10 -25
- data/src/ruby/spec/generic/client_stub_spec.rb +146 -35
- data/src/ruby/spec/generic/rpc_desc_spec.rb +10 -25
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +10 -25
- data/src/ruby/spec/generic/rpc_server_spec.rb +124 -34
- data/src/ruby/spec/generic/service_spec.rb +10 -25
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +10 -25
- data/src/ruby/spec/pb/health/checker_spec.rb +10 -25
- data/src/ruby/spec/server_credentials_spec.rb +10 -25
- data/src/ruby/spec/server_spec.rb +10 -25
- data/src/ruby/spec/spec_helper.rb +10 -25
- data/src/ruby/spec/time_consts_spec.rb +10 -25
- data/third_party/boringssl/crypto/aes/key_wrap.c +138 -0
- data/third_party/boringssl/crypto/asn1/a_bitstr.c +6 -3
- data/third_party/boringssl/crypto/asn1/a_enum.c +4 -1
- data/third_party/boringssl/crypto/asn1/a_gentm.c +20 -15
- data/third_party/boringssl/crypto/asn1/a_int.c +7 -4
- data/third_party/boringssl/crypto/asn1/a_object.c +5 -2
- data/third_party/boringssl/crypto/asn1/a_time.c +0 -1
- data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -2
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -2
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +35 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +3 -1
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +6 -3
- data/third_party/boringssl/crypto/asn1/tasn_new.c +12 -7
- data/third_party/boringssl/crypto/asn1/tasn_utl.c +22 -8
- data/third_party/boringssl/crypto/{time_support.c → asn1/time_support.c} +1 -1
- data/third_party/boringssl/crypto/asn1/x_long.c +5 -2
- data/third_party/boringssl/crypto/base64/base64.c +7 -5
- data/third_party/boringssl/crypto/bio/bio.c +24 -10
- data/third_party/boringssl/crypto/bio/bio_mem.c +12 -10
- data/third_party/boringssl/crypto/bio/connect.c +7 -18
- data/third_party/boringssl/crypto/bio/fd.c +3 -6
- data/third_party/boringssl/crypto/bio/file.c +6 -6
- data/third_party/boringssl/crypto/bio/hexdump.c +4 -2
- data/third_party/boringssl/crypto/bio/pair.c +30 -344
- data/third_party/boringssl/crypto/bio/socket.c +6 -7
- data/third_party/boringssl/crypto/bio/socket_helper.c +4 -3
- data/third_party/boringssl/crypto/bn/add.c +1 -1
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +11 -10
- data/third_party/boringssl/crypto/bn/bn.c +6 -20
- data/third_party/boringssl/crypto/bn/cmp.c +14 -0
- data/third_party/boringssl/crypto/bn/convert.c +73 -2
- data/third_party/boringssl/crypto/bn/ctx.c +3 -1
- data/third_party/boringssl/crypto/bn/div.c +108 -51
- data/third_party/boringssl/crypto/bn/exponentiation.c +15 -33
- data/third_party/boringssl/crypto/bn/gcd.c +29 -22
- data/third_party/boringssl/crypto/bn/generic.c +71 -67
- data/third_party/boringssl/crypto/bn/internal.h +19 -6
- data/third_party/boringssl/crypto/bn/kronecker.c +1 -0
- data/third_party/boringssl/crypto/bn/montgomery.c +9 -10
- data/third_party/boringssl/crypto/bn/montgomery_inv.c +47 -0
- data/third_party/boringssl/crypto/bn/mul.c +11 -9
- data/third_party/boringssl/crypto/bn/random.c +6 -3
- data/third_party/boringssl/crypto/bn/rsaz_exp.c +0 -65
- data/third_party/boringssl/crypto/bn/rsaz_exp.h +0 -3
- data/third_party/boringssl/crypto/bn/shift.c +9 -1
- data/third_party/boringssl/crypto/bn/sqrt.c +3 -1
- data/third_party/boringssl/crypto/buf/buf.c +6 -4
- data/third_party/boringssl/crypto/bytestring/asn1_compat.c +2 -1
- data/third_party/boringssl/crypto/bytestring/ber.c +2 -1
- data/third_party/boringssl/crypto/bytestring/cbb.c +9 -7
- data/third_party/boringssl/crypto/bytestring/cbs.c +54 -2
- data/third_party/boringssl/crypto/chacha/chacha.c +1 -1
- data/third_party/boringssl/crypto/cipher/aead.c +3 -3
- data/third_party/boringssl/crypto/cipher/cipher.c +18 -13
- data/third_party/boringssl/crypto/cipher/e_aes.c +335 -281
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +113 -137
- data/third_party/boringssl/crypto/cipher/e_null.c +2 -1
- data/third_party/boringssl/crypto/cipher/e_rc2.c +54 -49
- data/third_party/boringssl/crypto/cipher/e_ssl3.c +4 -3
- data/third_party/boringssl/crypto/cipher/e_tls.c +5 -5
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +41 -112
- data/third_party/boringssl/crypto/cmac/cmac.c +6 -4
- data/third_party/boringssl/crypto/conf/conf.c +6 -3
- data/third_party/boringssl/crypto/cpu-arm-linux.c +2 -2
- data/third_party/boringssl/crypto/curve25519/curve25519.c +28 -34
- data/third_party/boringssl/crypto/curve25519/spake25519.c +7 -6
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +2 -1
- data/third_party/boringssl/crypto/des/des.c +1 -1
- data/third_party/boringssl/crypto/des/internal.h +58 -46
- data/third_party/boringssl/crypto/dh/dh.c +4 -8
- data/third_party/boringssl/crypto/digest/digest.c +5 -2
- data/third_party/boringssl/crypto/digest/digests.c +70 -33
- data/third_party/boringssl/crypto/digest/md32_common.h +39 -27
- data/third_party/boringssl/crypto/dsa/dsa.c +11 -19
- data/third_party/boringssl/crypto/ec/ec.c +1 -1
- data/third_party/boringssl/crypto/ec/ec_asn1.c +3 -2
- data/third_party/boringssl/crypto/ec/ec_key.c +1 -1
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +6 -11
- data/third_party/boringssl/crypto/ec/oct.c +2 -14
- data/third_party/boringssl/crypto/ec/p224-64.c +78 -122
- data/third_party/boringssl/crypto/ec/p256-64.c +93 -133
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +48 -61
- data/third_party/boringssl/crypto/ec/p256-x86_64.h +113 -0
- data/third_party/boringssl/crypto/ec/simple.c +2 -1
- data/third_party/boringssl/crypto/ec/wnaf.c +52 -43
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -2
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +17 -16
- data/third_party/boringssl/crypto/engine/engine.c +3 -1
- data/third_party/boringssl/crypto/err/err.c +5 -5
- data/third_party/boringssl/crypto/evp/evp.c +1 -1
- data/third_party/boringssl/crypto/evp/evp_asn1.c +1 -1
- data/third_party/boringssl/crypto/evp/evp_ctx.c +23 -29
- data/third_party/boringssl/crypto/evp/p_ec.c +2 -1
- data/third_party/boringssl/crypto/evp/p_rsa.c +9 -3
- data/third_party/boringssl/crypto/evp/pbkdf.c +3 -1
- data/third_party/boringssl/crypto/hkdf/hkdf.c +3 -1
- data/third_party/boringssl/crypto/hmac/hmac.c +4 -2
- data/third_party/boringssl/crypto/internal.h +81 -0
- data/third_party/boringssl/crypto/lhash/lhash.c +7 -13
- data/third_party/boringssl/crypto/md4/md4.c +20 -18
- data/third_party/boringssl/crypto/md5/md5.c +31 -21
- data/third_party/boringssl/crypto/mem.c +4 -10
- data/third_party/boringssl/crypto/modes/cbc.c +2 -6
- data/third_party/boringssl/crypto/modes/cfb.c +2 -2
- data/third_party/boringssl/crypto/modes/ctr.c +1 -1
- data/third_party/boringssl/crypto/modes/gcm.c +117 -334
- data/third_party/boringssl/crypto/modes/internal.h +107 -84
- data/third_party/boringssl/crypto/modes/ofb.c +3 -3
- data/third_party/boringssl/crypto/modes/polyval.c +94 -0
- data/third_party/boringssl/crypto/obj/obj.c +13 -8
- data/third_party/boringssl/crypto/obj/obj_dat.h +6109 -5187
- data/third_party/boringssl/crypto/obj/obj_xref.c +55 -57
- data/third_party/boringssl/crypto/pem/pem_lib.c +6 -3
- data/third_party/boringssl/crypto/pkcs8/internal.h +27 -8
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +137 -352
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +371 -364
- data/third_party/boringssl/crypto/poly1305/poly1305.c +12 -18
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +2 -2
- data/third_party/boringssl/crypto/{newhope/reduce.c → pool/internal.h} +24 -21
- data/third_party/boringssl/crypto/pool/pool.c +200 -0
- data/third_party/boringssl/crypto/rand/deterministic.c +6 -5
- data/third_party/boringssl/crypto/rand/fuchsia.c +43 -0
- data/third_party/boringssl/crypto/rand/rand.c +7 -7
- data/third_party/boringssl/crypto/rand/urandom.c +136 -22
- data/third_party/boringssl/crypto/rand/windows.c +2 -2
- data/third_party/boringssl/crypto/rsa/blinding.c +2 -1
- data/third_party/boringssl/crypto/rsa/padding.c +11 -11
- data/third_party/boringssl/crypto/rsa/rsa.c +4 -4
- data/third_party/boringssl/crypto/rsa/rsa_asn1.c +7 -1
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +41 -80
- data/third_party/boringssl/crypto/sha/sha1-altivec.c +346 -0
- data/third_party/boringssl/crypto/sha/sha1.c +60 -42
- data/third_party/boringssl/crypto/sha/sha256.c +4 -2
- data/third_party/boringssl/crypto/sha/sha512.c +9 -7
- data/third_party/boringssl/crypto/stack/stack.c +10 -7
- data/third_party/boringssl/crypto/thread_pthread.c +2 -2
- data/third_party/boringssl/crypto/thread_win.c +2 -2
- data/third_party/boringssl/crypto/x509/a_verify.c +1 -1
- data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -1
- data/third_party/boringssl/crypto/x509/by_dir.c +1 -1
- data/third_party/boringssl/crypto/x509/t_x509.c +78 -38
- data/third_party/boringssl/crypto/x509/x509_cmp.c +8 -5
- data/third_party/boringssl/crypto/x509/x509_lu.c +6 -1
- data/third_party/boringssl/crypto/x509/x509_obj.c +4 -1
- data/third_party/boringssl/crypto/x509/x509_vfy.c +42 -8
- data/third_party/boringssl/crypto/x509/x509_vpm.c +8 -6
- data/third_party/boringssl/crypto/x509/x509name.c +4 -1
- data/third_party/boringssl/crypto/x509/x_crl.c +4 -2
- data/third_party/boringssl/crypto/x509/x_name.c +23 -13
- data/third_party/boringssl/crypto/x509/x_pkey.c +4 -1
- data/third_party/boringssl/crypto/x509/x_x509.c +42 -3
- data/third_party/boringssl/crypto/x509v3/pcy_int.h +2 -2
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +1 -1
- data/third_party/boringssl/crypto/x509v3/v3_ia5.c +4 -1
- data/third_party/boringssl/crypto/x509v3/v3_ncons.c +4 -1
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +6 -3
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +13 -21
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +19 -33
- data/third_party/boringssl/include/openssl/aead.h +9 -20
- data/third_party/boringssl/include/openssl/aes.h +21 -9
- data/third_party/boringssl/include/openssl/asn1.h +9 -1
- data/third_party/boringssl/include/openssl/base.h +33 -6
- data/third_party/boringssl/include/openssl/bio.h +10 -103
- data/third_party/boringssl/include/openssl/bn.h +58 -42
- data/third_party/boringssl/include/openssl/bytestring.h +17 -0
- data/third_party/boringssl/include/openssl/cipher.h +4 -3
- data/third_party/boringssl/include/openssl/conf.h +4 -1
- data/third_party/boringssl/include/openssl/curve25519.h +13 -0
- data/third_party/boringssl/include/openssl/digest.h +5 -3
- data/third_party/boringssl/include/openssl/dsa.h +5 -5
- data/third_party/boringssl/include/openssl/ec.h +2 -2
- data/third_party/boringssl/include/openssl/ecdh.h +3 -4
- data/third_party/boringssl/include/openssl/ecdsa.h +10 -10
- data/third_party/boringssl/include/openssl/err.h +5 -5
- data/third_party/boringssl/include/openssl/evp.h +11 -7
- data/third_party/boringssl/include/openssl/lhash.h +2 -3
- data/third_party/boringssl/include/openssl/lhash_macros.h +56 -14
- data/third_party/boringssl/include/openssl/nid.h +2949 -2916
- data/third_party/boringssl/include/openssl/obj.h +1 -1
- data/third_party/boringssl/include/openssl/pkcs8.h +21 -42
- data/third_party/boringssl/include/openssl/pool.h +87 -0
- data/third_party/boringssl/include/openssl/rand.h +1 -1
- data/third_party/boringssl/include/openssl/rsa.h +4 -2
- data/third_party/boringssl/include/openssl/sha.h +0 -4
- data/third_party/boringssl/include/openssl/ssl.h +327 -662
- data/third_party/boringssl/include/openssl/ssl3.h +1 -21
- data/third_party/boringssl/include/openssl/stack.h +1 -0
- data/third_party/boringssl/include/openssl/stack_macros.h +85 -0
- data/third_party/boringssl/include/openssl/tls1.h +23 -52
- data/third_party/boringssl/include/openssl/type_check.h +4 -0
- data/third_party/boringssl/include/openssl/x509.h +10 -59
- data/third_party/boringssl/include/openssl/x509_vfy.h +7 -1
- data/third_party/boringssl/include/openssl/x509v3.h +4 -4
- data/third_party/boringssl/ssl/bio_ssl.c +175 -0
- data/third_party/boringssl/ssl/custom_extensions.c +24 -21
- data/third_party/boringssl/ssl/d1_both.c +259 -289
- data/third_party/boringssl/ssl/d1_lib.c +8 -20
- data/third_party/boringssl/ssl/d1_pkt.c +6 -15
- data/third_party/boringssl/ssl/dtls_method.c +22 -8
- data/third_party/boringssl/ssl/dtls_record.c +27 -2
- data/third_party/boringssl/ssl/handshake_client.c +460 -579
- data/third_party/boringssl/ssl/handshake_server.c +662 -644
- data/third_party/boringssl/ssl/internal.h +1009 -375
- data/third_party/boringssl/ssl/s3_both.c +312 -162
- data/third_party/boringssl/ssl/s3_lib.c +12 -128
- data/third_party/boringssl/ssl/s3_pkt.c +22 -30
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +28 -22
- data/third_party/boringssl/ssl/ssl_asn1.c +210 -114
- data/third_party/boringssl/ssl/ssl_buffer.c +2 -1
- data/third_party/boringssl/ssl/ssl_cert.c +417 -219
- data/third_party/boringssl/ssl/ssl_cipher.c +191 -393
- data/third_party/boringssl/ssl/ssl_ecdh.c +19 -164
- data/third_party/boringssl/ssl/ssl_file.c +0 -11
- data/third_party/boringssl/ssl/ssl_lib.c +325 -652
- data/third_party/boringssl/ssl/{ssl_rsa.c → ssl_privkey.c} +21 -131
- data/third_party/boringssl/ssl/ssl_privkey_cc.cc +76 -0
- data/third_party/boringssl/ssl/ssl_session.c +206 -95
- data/third_party/boringssl/ssl/ssl_stat.c +18 -84
- data/third_party/boringssl/ssl/{s3_enc.c → ssl_transcript.c} +150 -157
- data/third_party/boringssl/ssl/ssl_x509.c +815 -0
- data/third_party/boringssl/ssl/t1_enc.c +188 -174
- data/third_party/boringssl/ssl/t1_lib.c +1064 -764
- data/third_party/boringssl/ssl/tls13_both.c +290 -96
- data/third_party/boringssl/ssl/tls13_client.c +344 -314
- data/third_party/boringssl/ssl/tls13_enc.c +239 -200
- data/third_party/boringssl/ssl/tls13_server.c +374 -366
- data/third_party/boringssl/ssl/tls_method.c +40 -5
- data/third_party/boringssl/ssl/tls_record.c +166 -71
- metadata +39 -25
- data/src/core/lib/iomgr/workqueue.h +0 -87
- data/src/core/lib/iomgr/workqueue_uv.c +0 -65
- data/src/core/lib/iomgr/workqueue_uv.h +0 -37
- data/src/core/lib/iomgr/workqueue_windows.c +0 -63
- data/src/core/lib/iomgr/workqueue_windows.h +0 -37
- data/third_party/boringssl/crypto/bio/buffer.c +0 -496
- data/third_party/boringssl/crypto/newhope/error_correction.c +0 -131
- data/third_party/boringssl/crypto/newhope/internal.h +0 -71
- data/third_party/boringssl/crypto/newhope/newhope.c +0 -174
- data/third_party/boringssl/crypto/newhope/ntt.c +0 -148
- data/third_party/boringssl/crypto/newhope/poly.c +0 -183
- data/third_party/boringssl/crypto/newhope/precomp.c +0 -306
- data/third_party/boringssl/crypto/obj/obj_xref.h +0 -96
- data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +0 -151
- data/third_party/boringssl/include/openssl/newhope.h +0 -158
- data/third_party/boringssl/include/openssl/time_support.h +0 -91
@@ -1,33 +1,18 @@
|
|
1
1
|
/*
|
2
2
|
*
|
3
|
-
* Copyright 2016
|
4
|
-
* All rights reserved.
|
3
|
+
* Copyright 2016 gRPC authors.
|
5
4
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
9
8
|
*
|
10
|
-
*
|
11
|
-
* notice, this list of conditions and the following disclaimer.
|
12
|
-
* * Redistributions in binary form must reproduce the above
|
13
|
-
* copyright notice, this list of conditions and the following disclaimer
|
14
|
-
* in the documentation and/or other materials provided with the
|
15
|
-
* distribution.
|
16
|
-
* * Neither the name of Google Inc. nor the names of its
|
17
|
-
* contributors may be used to endorse or promote products derived from
|
18
|
-
* this software without specific prior written permission.
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
19
10
|
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
25
|
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
31
16
|
*
|
32
17
|
*/
|
33
18
|
|
@@ -1,33 +1,18 @@
|
|
1
1
|
/*
|
2
2
|
*
|
3
|
-
* Copyright 2015
|
4
|
-
* All rights reserved.
|
3
|
+
* Copyright 2015 gRPC authors.
|
5
4
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
9
8
|
*
|
10
|
-
*
|
11
|
-
* notice, this list of conditions and the following disclaimer.
|
12
|
-
* * Redistributions in binary form must reproduce the above
|
13
|
-
* copyright notice, this list of conditions and the following disclaimer
|
14
|
-
* in the documentation and/or other materials provided with the
|
15
|
-
* distribution.
|
16
|
-
* * Neither the name of Google Inc. nor the names of its
|
17
|
-
* contributors may be used to endorse or promote products derived from
|
18
|
-
* this software without specific prior written permission.
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
19
10
|
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
25
|
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
31
16
|
*
|
32
17
|
*/
|
33
18
|
|
@@ -126,9 +111,10 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
|
|
126
111
|
} else {
|
127
112
|
grpc_channel_element *client_channel_elem = grpc_channel_stack_last_element(
|
128
113
|
grpc_channel_get_channel_stack(w->channel));
|
129
|
-
grpc_client_channel_watch_connectivity_state(
|
130
|
-
|
131
|
-
|
114
|
+
grpc_client_channel_watch_connectivity_state(
|
115
|
+
exec_ctx, client_channel_elem,
|
116
|
+
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)), NULL,
|
117
|
+
&w->on_complete, NULL);
|
132
118
|
}
|
133
119
|
|
134
120
|
gpr_mu_lock(&w->mu);
|
@@ -222,12 +208,12 @@ void grpc_channel_watch_connectivity_state(
|
|
222
208
|
7, (channel, (int)last_observed_state, deadline.tv_sec, deadline.tv_nsec,
|
223
209
|
(int)deadline.clock_type, cq, tag));
|
224
210
|
|
225
|
-
grpc_cq_begin_op(cq, tag);
|
211
|
+
GPR_ASSERT(grpc_cq_begin_op(cq, tag));
|
226
212
|
|
227
213
|
gpr_mu_init(&w->mu);
|
228
|
-
|
214
|
+
GRPC_CLOSURE_INIT(&w->on_complete, watch_complete, w,
|
229
215
|
grpc_schedule_on_exec_ctx);
|
230
|
-
|
216
|
+
GRPC_CLOSURE_INIT(&w->on_timeout, timeout_complete, w,
|
231
217
|
grpc_schedule_on_exec_ctx);
|
232
218
|
w->phase = WAITING;
|
233
219
|
w->state = last_observed_state;
|
@@ -239,13 +225,14 @@ void grpc_channel_watch_connectivity_state(
|
|
239
225
|
watcher_timer_init_arg *wa = gpr_malloc(sizeof(watcher_timer_init_arg));
|
240
226
|
wa->w = w;
|
241
227
|
wa->deadline = deadline;
|
242
|
-
|
228
|
+
GRPC_CLOSURE_INIT(&w->watcher_timer_init, watcher_timer_init, wa,
|
243
229
|
grpc_schedule_on_exec_ctx);
|
244
230
|
|
245
231
|
if (client_channel_elem->filter == &grpc_client_channel_filter) {
|
246
232
|
GRPC_CHANNEL_INTERNAL_REF(channel, "watch_channel_connectivity");
|
247
233
|
grpc_client_channel_watch_connectivity_state(
|
248
|
-
&exec_ctx, client_channel_elem,
|
234
|
+
&exec_ctx, client_channel_elem,
|
235
|
+
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(cq)), &w->state,
|
249
236
|
&w->on_complete, &w->watcher_timer_init);
|
250
237
|
} else {
|
251
238
|
abort();
|
@@ -1,33 +1,18 @@
|
|
1
1
|
/*
|
2
2
|
*
|
3
|
-
* Copyright 2015
|
4
|
-
* All rights reserved.
|
3
|
+
* Copyright 2015 gRPC authors.
|
5
4
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
9
8
|
*
|
10
|
-
*
|
11
|
-
* notice, this list of conditions and the following disclaimer.
|
12
|
-
* * Redistributions in binary form must reproduce the above
|
13
|
-
* copyright notice, this list of conditions and the following disclaimer
|
14
|
-
* in the documentation and/or other materials provided with the
|
15
|
-
* distribution.
|
16
|
-
* * Neither the name of Google Inc. nor the names of its
|
17
|
-
* contributors may be used to endorse or promote products derived from
|
18
|
-
* this software without specific prior written permission.
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
19
10
|
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
25
|
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
31
16
|
*
|
32
17
|
*/
|
33
18
|
|
@@ -67,6 +52,9 @@
|
|
67
52
|
|
68
53
|
/* Client channel implementation */
|
69
54
|
|
55
|
+
grpc_tracer_flag grpc_client_channel_trace =
|
56
|
+
GRPC_TRACER_INITIALIZER(false, "client_channel");
|
57
|
+
|
70
58
|
/*************************************************************************
|
71
59
|
* METHOD-CONFIG TABLE
|
72
60
|
*/
|
@@ -193,8 +181,8 @@ typedef struct client_channel_channel_data {
|
|
193
181
|
grpc_slice_hash_table *method_params_table;
|
194
182
|
/** incoming resolver result - set by resolver.next() */
|
195
183
|
grpc_channel_args *resolver_result;
|
196
|
-
/** a list of closures that are all waiting for
|
197
|
-
grpc_closure_list
|
184
|
+
/** a list of closures that are all waiting for resolver result to come in */
|
185
|
+
grpc_closure_list waiting_for_resolver_result_closures;
|
198
186
|
/** resolver callback */
|
199
187
|
grpc_closure on_resolver_result_changed;
|
200
188
|
/** connectivity state being tracked */
|
@@ -256,6 +244,10 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
|
|
256
244
|
GRPC_ERROR_REF(error));
|
257
245
|
}
|
258
246
|
}
|
247
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
248
|
+
gpr_log(GPR_DEBUG, "chand=%p: setting connectivity state to %s", chand,
|
249
|
+
grpc_connectivity_state_name(state));
|
250
|
+
}
|
259
251
|
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, error,
|
260
252
|
reason);
|
261
253
|
}
|
@@ -266,6 +258,10 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx,
|
|
266
258
|
grpc_connectivity_state publish_state = w->state;
|
267
259
|
/* check if the notification is for the latest policy */
|
268
260
|
if (w->lb_policy == w->chand->lb_policy) {
|
261
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
262
|
+
gpr_log(GPR_DEBUG, "chand=%p: lb_policy=%p state changed to %s", w->chand,
|
263
|
+
w->lb_policy, grpc_connectivity_state_name(w->state));
|
264
|
+
}
|
269
265
|
if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) {
|
270
266
|
publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
271
267
|
grpc_resolver_channel_saw_error_locked(exec_ctx, w->chand->resolver);
|
@@ -278,7 +274,6 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx,
|
|
278
274
|
watch_lb_policy_locked(exec_ctx, w->chand, w->lb_policy, w->state);
|
279
275
|
}
|
280
276
|
}
|
281
|
-
|
282
277
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy");
|
283
278
|
gpr_free(w);
|
284
279
|
}
|
@@ -288,16 +283,27 @@ static void watch_lb_policy_locked(grpc_exec_ctx *exec_ctx, channel_data *chand,
|
|
288
283
|
grpc_connectivity_state current_state) {
|
289
284
|
lb_policy_connectivity_watcher *w = gpr_malloc(sizeof(*w));
|
290
285
|
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "watch_lb_policy");
|
291
|
-
|
292
286
|
w->chand = chand;
|
293
|
-
|
294
|
-
grpc_combiner_scheduler(chand->combiner
|
287
|
+
GRPC_CLOSURE_INIT(&w->on_changed, on_lb_policy_state_changed_locked, w,
|
288
|
+
grpc_combiner_scheduler(chand->combiner));
|
295
289
|
w->state = current_state;
|
296
290
|
w->lb_policy = lb_policy;
|
297
291
|
grpc_lb_policy_notify_on_state_change_locked(exec_ctx, lb_policy, &w->state,
|
298
292
|
&w->on_changed);
|
299
293
|
}
|
300
294
|
|
295
|
+
static void start_resolving_locked(grpc_exec_ctx *exec_ctx,
|
296
|
+
channel_data *chand) {
|
297
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
298
|
+
gpr_log(GPR_DEBUG, "chand=%p: starting name resolution", chand);
|
299
|
+
}
|
300
|
+
GPR_ASSERT(!chand->started_resolving);
|
301
|
+
chand->started_resolving = true;
|
302
|
+
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
|
303
|
+
grpc_resolver_next_locked(exec_ctx, chand->resolver, &chand->resolver_result,
|
304
|
+
&chand->on_resolver_result_changed);
|
305
|
+
}
|
306
|
+
|
301
307
|
typedef struct {
|
302
308
|
char *server_name;
|
303
309
|
grpc_server_retry_throttle_data *retry_throttle_data;
|
@@ -357,48 +363,21 @@ static void parse_retry_throttle_params(const grpc_json *field, void *arg) {
|
|
357
363
|
}
|
358
364
|
}
|
359
365
|
|
360
|
-
// Wrap a closure associated with \a lb_policy. The associated callback (\a
|
361
|
-
// wrapped_on_pick_closure_cb) is responsible for unref'ing \a lb_policy after
|
362
|
-
// scheduling \a wrapped_closure.
|
363
|
-
typedef struct wrapped_on_pick_closure_arg {
|
364
|
-
/* the closure instance using this struct as argument */
|
365
|
-
grpc_closure wrapper_closure;
|
366
|
-
|
367
|
-
/* the original closure. Usually a on_complete/notify cb for pick() and ping()
|
368
|
-
* calls against the internal RR instance, respectively. */
|
369
|
-
grpc_closure *wrapped_closure;
|
370
|
-
|
371
|
-
/* The policy instance related to the closure */
|
372
|
-
grpc_lb_policy *lb_policy;
|
373
|
-
} wrapped_on_pick_closure_arg;
|
374
|
-
|
375
|
-
// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free \a arg.
|
376
|
-
static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg,
|
377
|
-
grpc_error *error) {
|
378
|
-
wrapped_on_pick_closure_arg *wc_arg = arg;
|
379
|
-
GPR_ASSERT(wc_arg != NULL);
|
380
|
-
GPR_ASSERT(wc_arg->wrapped_closure != NULL);
|
381
|
-
GPR_ASSERT(wc_arg->lb_policy != NULL);
|
382
|
-
grpc_closure_run(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
|
383
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping");
|
384
|
-
gpr_free(wc_arg);
|
385
|
-
}
|
386
|
-
|
387
366
|
static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
|
388
367
|
void *arg, grpc_error *error) {
|
389
368
|
channel_data *chand = arg;
|
369
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
370
|
+
gpr_log(GPR_DEBUG, "chand=%p: got resolver result: error=%s", chand,
|
371
|
+
grpc_error_string(error));
|
372
|
+
}
|
373
|
+
// Extract the following fields from the resolver result, if non-NULL.
|
374
|
+
bool lb_policy_updated = false;
|
390
375
|
char *lb_policy_name = NULL;
|
391
|
-
|
392
|
-
grpc_lb_policy *
|
393
|
-
grpc_slice_hash_table *method_params_table = NULL;
|
394
|
-
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
395
|
-
bool exit_idle = false;
|
396
|
-
grpc_error *state_error =
|
397
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy");
|
376
|
+
bool lb_policy_name_changed = false;
|
377
|
+
grpc_lb_policy *new_lb_policy = NULL;
|
398
378
|
char *service_config_json = NULL;
|
399
|
-
|
400
|
-
|
401
|
-
|
379
|
+
grpc_server_retry_throttle_data *retry_throttle_data = NULL;
|
380
|
+
grpc_slice_hash_table *method_params_table = NULL;
|
402
381
|
if (chand->resolver_result != NULL) {
|
403
382
|
// Find LB policy name.
|
404
383
|
const grpc_arg *channel_arg =
|
@@ -433,18 +412,29 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
|
|
433
412
|
// Use pick_first if nothing was specified and we didn't select grpclb
|
434
413
|
// above.
|
435
414
|
if (lb_policy_name == NULL) lb_policy_name = "pick_first";
|
436
|
-
// Instantiate LB policy.
|
437
415
|
grpc_lb_policy_args lb_policy_args;
|
438
416
|
lb_policy_args.args = chand->resolver_result;
|
439
417
|
lb_policy_args.client_channel_factory = chand->client_channel_factory;
|
440
418
|
lb_policy_args.combiner = chand->combiner;
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
419
|
+
// Check to see if we're already using the right LB policy.
|
420
|
+
// Note: It's safe to use chand->info_lb_policy_name here without
|
421
|
+
// taking a lock on chand->info_mu, because this function is the
|
422
|
+
// only thing that modifies its value, and it can only be invoked
|
423
|
+
// once at any given time.
|
424
|
+
lb_policy_name_changed =
|
425
|
+
chand->info_lb_policy_name == NULL ||
|
426
|
+
strcmp(chand->info_lb_policy_name, lb_policy_name) != 0;
|
427
|
+
if (chand->lb_policy != NULL && !lb_policy_name_changed) {
|
428
|
+
// Continue using the same LB policy. Update with new addresses.
|
429
|
+
lb_policy_updated = true;
|
430
|
+
grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args);
|
431
|
+
} else {
|
432
|
+
// Instantiate new LB policy.
|
433
|
+
new_lb_policy =
|
434
|
+
grpc_lb_policy_create(exec_ctx, lb_policy_name, &lb_policy_args);
|
435
|
+
if (new_lb_policy == NULL) {
|
436
|
+
gpr_log(GPR_ERROR, "could not create LB policy \"%s\"", lb_policy_name);
|
437
|
+
}
|
448
438
|
}
|
449
439
|
// Find service config.
|
450
440
|
channel_arg =
|
@@ -462,12 +452,14 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
|
|
462
452
|
grpc_uri *uri =
|
463
453
|
grpc_uri_parse(exec_ctx, channel_arg->value.string, true);
|
464
454
|
GPR_ASSERT(uri->path[0] != '\0');
|
455
|
+
service_config_parsing_state parsing_state;
|
456
|
+
memset(&parsing_state, 0, sizeof(parsing_state));
|
465
457
|
parsing_state.server_name =
|
466
458
|
uri->path[0] == '/' ? uri->path + 1 : uri->path;
|
467
459
|
grpc_service_config_parse_global_params(
|
468
460
|
service_config, parse_retry_throttle_params, &parsing_state);
|
469
|
-
parsing_state.server_name = NULL;
|
470
461
|
grpc_uri_destroy(uri);
|
462
|
+
retry_throttle_data = parsing_state.retry_throttle_data;
|
471
463
|
method_params_table = grpc_service_config_create_method_config_table(
|
472
464
|
exec_ctx, service_config, method_parameters_create_from_json,
|
473
465
|
method_parameters_free);
|
@@ -481,88 +473,115 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
|
|
481
473
|
grpc_channel_args_destroy(exec_ctx, chand->resolver_result);
|
482
474
|
chand->resolver_result = NULL;
|
483
475
|
}
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
476
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
477
|
+
gpr_log(GPR_DEBUG,
|
478
|
+
"chand=%p: resolver result: lb_policy_name=\"%s\"%s, "
|
479
|
+
"service_config=\"%s\"",
|
480
|
+
chand, lb_policy_name, lb_policy_name_changed ? " (changed)" : "",
|
481
|
+
service_config_json);
|
482
|
+
}
|
483
|
+
// Now swap out fields in chand. Note that the new values may still
|
484
|
+
// be NULL if (e.g.) the resolver failed to return results or the
|
485
|
+
// results did not contain the necessary data.
|
486
|
+
//
|
487
|
+
// First, swap out the data used by cc_get_channel_info().
|
490
488
|
gpr_mu_lock(&chand->info_mu);
|
491
489
|
if (lb_policy_name != NULL) {
|
492
490
|
gpr_free(chand->info_lb_policy_name);
|
493
491
|
chand->info_lb_policy_name = lb_policy_name;
|
494
492
|
}
|
495
|
-
old_lb_policy = chand->lb_policy;
|
496
|
-
chand->lb_policy = lb_policy;
|
497
493
|
if (service_config_json != NULL) {
|
498
494
|
gpr_free(chand->info_service_config_json);
|
499
495
|
chand->info_service_config_json = service_config_json;
|
500
496
|
}
|
501
497
|
gpr_mu_unlock(&chand->info_mu);
|
502
|
-
|
498
|
+
// Swap out the retry throttle data.
|
503
499
|
if (chand->retry_throttle_data != NULL) {
|
504
500
|
grpc_server_retry_throttle_data_unref(chand->retry_throttle_data);
|
505
501
|
}
|
506
|
-
chand->retry_throttle_data =
|
502
|
+
chand->retry_throttle_data = retry_throttle_data;
|
503
|
+
// Swap out the method params table.
|
507
504
|
if (chand->method_params_table != NULL) {
|
508
505
|
grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
|
509
506
|
}
|
510
507
|
chand->method_params_table = method_params_table;
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
508
|
+
// If we have a new LB policy or are shutting down (in which case
|
509
|
+
// new_lb_policy will be NULL), swap out the LB policy, unreffing the
|
510
|
+
// old one and removing its fds from chand->interested_parties.
|
511
|
+
// Note that we do NOT do this if either (a) we updated the existing
|
512
|
+
// LB policy above or (b) we failed to create the new LB policy (in
|
513
|
+
// which case we want to continue using the most recent one we had).
|
514
|
+
if (new_lb_policy != NULL || error != GRPC_ERROR_NONE ||
|
515
|
+
chand->resolver == NULL) {
|
516
|
+
if (chand->lb_policy != NULL) {
|
517
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
518
|
+
gpr_log(GPR_DEBUG, "chand=%p: unreffing lb_policy=%p", chand,
|
519
|
+
chand->lb_policy);
|
520
|
+
}
|
521
|
+
grpc_pollset_set_del_pollset_set(exec_ctx,
|
522
|
+
chand->lb_policy->interested_parties,
|
523
|
+
chand->interested_parties);
|
524
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
|
525
|
+
}
|
526
|
+
chand->lb_policy = new_lb_policy;
|
523
527
|
}
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
watch_lb_policy_locked(exec_ctx, chand, lb_policy, state);
|
528
|
+
// Now that we've swapped out the relevant fields of chand, check for
|
529
|
+
// error or shutdown.
|
530
|
+
if (error != GRPC_ERROR_NONE || chand->resolver == NULL) {
|
531
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
532
|
+
gpr_log(GPR_DEBUG, "chand=%p: shutting down", chand);
|
530
533
|
}
|
531
|
-
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
|
532
|
-
grpc_resolver_next_locked(exec_ctx, chand->resolver,
|
533
|
-
&chand->resolver_result,
|
534
|
-
&chand->on_resolver_result_changed);
|
535
|
-
} else {
|
536
534
|
if (chand->resolver != NULL) {
|
535
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
536
|
+
gpr_log(GPR_DEBUG, "chand=%p: shutting down resolver", chand);
|
537
|
+
}
|
537
538
|
grpc_resolver_shutdown_locked(exec_ctx, chand->resolver);
|
538
539
|
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
|
539
540
|
chand->resolver = NULL;
|
540
541
|
}
|
541
|
-
grpc_error *refs[] = {error, state_error};
|
542
542
|
set_channel_connectivity_state_locked(
|
543
543
|
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
|
544
544
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
545
|
-
"Got
|
545
|
+
"Got resolver result after disconnection", &error, 1),
|
546
546
|
"resolver_gone");
|
547
|
+
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver");
|
548
|
+
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
|
549
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
550
|
+
"Channel disconnected", &error, 1));
|
551
|
+
GRPC_CLOSURE_LIST_SCHED(exec_ctx,
|
552
|
+
&chand->waiting_for_resolver_result_closures);
|
553
|
+
} else { // Not shutting down.
|
554
|
+
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
555
|
+
grpc_error *state_error =
|
556
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy");
|
557
|
+
if (new_lb_policy != NULL) {
|
558
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
559
|
+
gpr_log(GPR_DEBUG, "chand=%p: initializing new LB policy", chand);
|
560
|
+
}
|
561
|
+
GRPC_ERROR_UNREF(state_error);
|
562
|
+
state = grpc_lb_policy_check_connectivity_locked(exec_ctx, new_lb_policy,
|
563
|
+
&state_error);
|
564
|
+
grpc_pollset_set_add_pollset_set(exec_ctx,
|
565
|
+
new_lb_policy->interested_parties,
|
566
|
+
chand->interested_parties);
|
567
|
+
GRPC_CLOSURE_LIST_SCHED(exec_ctx,
|
568
|
+
&chand->waiting_for_resolver_result_closures);
|
569
|
+
if (chand->exit_idle_when_lb_policy_arrives) {
|
570
|
+
grpc_lb_policy_exit_idle_locked(exec_ctx, new_lb_policy);
|
571
|
+
chand->exit_idle_when_lb_policy_arrives = false;
|
572
|
+
}
|
573
|
+
watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state);
|
574
|
+
}
|
575
|
+
if (!lb_policy_updated) {
|
576
|
+
set_channel_connectivity_state_locked(exec_ctx, chand, state,
|
577
|
+
GRPC_ERROR_REF(state_error),
|
578
|
+
"new_lb+resolver");
|
579
|
+
}
|
580
|
+
grpc_resolver_next_locked(exec_ctx, chand->resolver,
|
581
|
+
&chand->resolver_result,
|
582
|
+
&chand->on_resolver_result_changed);
|
583
|
+
GRPC_ERROR_UNREF(state_error);
|
547
584
|
}
|
548
|
-
|
549
|
-
if (exit_idle) {
|
550
|
-
grpc_lb_policy_exit_idle_locked(exec_ctx, lb_policy);
|
551
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "exit_idle");
|
552
|
-
}
|
553
|
-
|
554
|
-
if (old_lb_policy != NULL) {
|
555
|
-
grpc_pollset_set_del_pollset_set(
|
556
|
-
exec_ctx, old_lb_policy->interested_parties, chand->interested_parties);
|
557
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, old_lb_policy, "channel");
|
558
|
-
}
|
559
|
-
|
560
|
-
if (lb_policy != NULL) {
|
561
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "config_change");
|
562
|
-
}
|
563
|
-
|
564
|
-
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver");
|
565
|
-
GRPC_ERROR_UNREF(state_error);
|
566
585
|
}
|
567
586
|
|
568
587
|
static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
@@ -581,7 +600,7 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
581
600
|
|
582
601
|
if (op->send_ping != NULL) {
|
583
602
|
if (chand->lb_policy == NULL) {
|
584
|
-
|
603
|
+
GRPC_CLOSURE_SCHED(
|
585
604
|
exec_ctx, op->send_ping,
|
586
605
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Ping with no load balancing"));
|
587
606
|
} else {
|
@@ -600,9 +619,10 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
600
619
|
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
|
601
620
|
chand->resolver = NULL;
|
602
621
|
if (!chand->started_resolving) {
|
603
|
-
grpc_closure_list_fail_all(&chand->
|
622
|
+
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
|
604
623
|
GRPC_ERROR_REF(op->disconnect_with_error));
|
605
|
-
|
624
|
+
GRPC_CLOSURE_LIST_SCHED(exec_ctx,
|
625
|
+
&chand->waiting_for_resolver_result_closures);
|
606
626
|
}
|
607
627
|
if (chand->lb_policy != NULL) {
|
608
628
|
grpc_pollset_set_del_pollset_set(exec_ctx,
|
@@ -616,7 +636,7 @@ static void start_transport_op_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
616
636
|
}
|
617
637
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "start_transport_op");
|
618
638
|
|
619
|
-
|
639
|
+
GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
|
620
640
|
}
|
621
641
|
|
622
642
|
static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
@@ -632,10 +652,10 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
632
652
|
|
633
653
|
op->handler_private.extra_arg = elem;
|
634
654
|
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "start_transport_op");
|
635
|
-
|
655
|
+
GRPC_CLOSURE_SCHED(
|
636
656
|
exec_ctx,
|
637
|
-
|
638
|
-
op, grpc_combiner_scheduler(chand->combiner
|
657
|
+
GRPC_CLOSURE_INIT(&op->handler_private.closure, start_transport_op_locked,
|
658
|
+
op, grpc_combiner_scheduler(chand->combiner)),
|
639
659
|
GRPC_ERROR_NONE);
|
640
660
|
}
|
641
661
|
|
@@ -666,7 +686,7 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
666
686
|
GPR_ASSERT(args->is_last);
|
667
687
|
GPR_ASSERT(elem->filter == &grpc_client_channel_filter);
|
668
688
|
// Initialize data members.
|
669
|
-
chand->combiner = grpc_combiner_create(
|
689
|
+
chand->combiner = grpc_combiner_create();
|
670
690
|
gpr_mu_init(&chand->info_mu);
|
671
691
|
gpr_mu_init(&chand->external_connectivity_watcher_list_mu);
|
672
692
|
|
@@ -675,9 +695,9 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
675
695
|
gpr_mu_unlock(&chand->external_connectivity_watcher_list_mu);
|
676
696
|
|
677
697
|
chand->owning_stack = args->channel_stack;
|
678
|
-
|
698
|
+
GRPC_CLOSURE_INIT(&chand->on_resolver_result_changed,
|
679
699
|
on_resolver_result_changed_locked, chand,
|
680
|
-
grpc_combiner_scheduler(chand->combiner
|
700
|
+
grpc_combiner_scheduler(chand->combiner));
|
681
701
|
chand->interested_parties = grpc_pollset_set_create();
|
682
702
|
grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
|
683
703
|
"client_channel");
|
@@ -735,10 +755,9 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
735
755
|
grpc_channel_element *elem) {
|
736
756
|
channel_data *chand = elem->channel_data;
|
737
757
|
if (chand->resolver != NULL) {
|
738
|
-
|
739
|
-
exec_ctx,
|
740
|
-
|
741
|
-
grpc_combiner_scheduler(chand->combiner, false)),
|
758
|
+
GRPC_CLOSURE_SCHED(
|
759
|
+
exec_ctx, GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver,
|
760
|
+
grpc_combiner_scheduler(chand->combiner)),
|
742
761
|
GRPC_ERROR_NONE);
|
743
762
|
}
|
744
763
|
if (chand->client_channel_factory != NULL) {
|
@@ -769,10 +788,15 @@ static void cc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
769
788
|
* PER-CALL FUNCTIONS
|
770
789
|
*/
|
771
790
|
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
791
|
+
// Max number of batches that can be pending on a call at any given
|
792
|
+
// time. This includes:
|
793
|
+
// recv_initial_metadata
|
794
|
+
// send_initial_metadata
|
795
|
+
// recv_message
|
796
|
+
// send_message
|
797
|
+
// recv_trailing_metadata
|
798
|
+
// send_trailing_metadata
|
799
|
+
#define MAX_WAITING_BATCHES 6
|
776
800
|
|
777
801
|
/** Call data. Holds a pointer to grpc_subchannel_call and the
|
778
802
|
associated machinery to create such a pointer.
|
@@ -794,23 +818,22 @@ typedef struct client_channel_call_data {
|
|
794
818
|
grpc_server_retry_throttle_data *retry_throttle_data;
|
795
819
|
method_parameters *method_params;
|
796
820
|
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
grpc_subchannel_call */
|
801
|
-
gpr_atm subchannel_call;
|
821
|
+
/** either 0 for no call, a pointer to a grpc_subchannel_call (if the lowest
|
822
|
+
bit is 0), or a pointer to an error (if the lowest bit is 1) */
|
823
|
+
gpr_atm subchannel_call_or_error;
|
802
824
|
gpr_arena *arena;
|
803
825
|
|
804
|
-
|
826
|
+
grpc_lb_policy *lb_policy; // Holds ref while LB pick is pending.
|
827
|
+
grpc_closure lb_pick_closure;
|
828
|
+
|
805
829
|
grpc_connected_subchannel *connected_subchannel;
|
806
830
|
grpc_call_context_element subchannel_call_context[GRPC_CONTEXT_COUNT];
|
807
831
|
grpc_polling_entity *pollent;
|
808
832
|
|
809
|
-
grpc_transport_stream_op_batch
|
810
|
-
size_t
|
811
|
-
size_t waiting_ops_capacity;
|
833
|
+
grpc_transport_stream_op_batch *waiting_for_pick_batches[MAX_WAITING_BATCHES];
|
834
|
+
size_t waiting_for_pick_batches_count;
|
812
835
|
|
813
|
-
|
836
|
+
grpc_transport_stream_op_batch_payload *initial_metadata_payload;
|
814
837
|
|
815
838
|
grpc_call_stack *owning_call;
|
816
839
|
|
@@ -820,65 +843,103 @@ typedef struct client_channel_call_data {
|
|
820
843
|
grpc_closure *original_on_complete;
|
821
844
|
} call_data;
|
822
845
|
|
846
|
+
typedef struct {
|
847
|
+
grpc_subchannel_call *subchannel_call;
|
848
|
+
grpc_error *error;
|
849
|
+
} call_or_error;
|
850
|
+
|
851
|
+
static call_or_error get_call_or_error(call_data *p) {
|
852
|
+
gpr_atm c = gpr_atm_acq_load(&p->subchannel_call_or_error);
|
853
|
+
if (c == 0)
|
854
|
+
return (call_or_error){NULL, NULL};
|
855
|
+
else if (c & 1)
|
856
|
+
return (call_or_error){NULL, (grpc_error *)((c) & ~(gpr_atm)1)};
|
857
|
+
else
|
858
|
+
return (call_or_error){(grpc_subchannel_call *)c, NULL};
|
859
|
+
}
|
860
|
+
|
861
|
+
static bool set_call_or_error(call_data *p, call_or_error coe) {
|
862
|
+
// this should always be under a lock
|
863
|
+
call_or_error existing = get_call_or_error(p);
|
864
|
+
if (existing.error != GRPC_ERROR_NONE) {
|
865
|
+
GRPC_ERROR_UNREF(coe.error);
|
866
|
+
return false;
|
867
|
+
}
|
868
|
+
GPR_ASSERT(existing.subchannel_call == NULL);
|
869
|
+
if (coe.error != GRPC_ERROR_NONE) {
|
870
|
+
GPR_ASSERT(coe.subchannel_call == NULL);
|
871
|
+
gpr_atm_rel_store(&p->subchannel_call_or_error, 1 | (gpr_atm)coe.error);
|
872
|
+
} else {
|
873
|
+
GPR_ASSERT(coe.subchannel_call != NULL);
|
874
|
+
gpr_atm_rel_store(&p->subchannel_call_or_error,
|
875
|
+
(gpr_atm)coe.subchannel_call);
|
876
|
+
}
|
877
|
+
return true;
|
878
|
+
}
|
879
|
+
|
823
880
|
grpc_subchannel_call *grpc_client_channel_get_subchannel_call(
|
824
881
|
grpc_call_element *call_elem) {
|
825
|
-
|
826
|
-
return scc == CANCELLED_CALL ? NULL : scc;
|
882
|
+
return get_call_or_error(call_elem->call_data).subchannel_call;
|
827
883
|
}
|
828
884
|
|
829
|
-
static void
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
calld->waiting_ops =
|
835
|
-
gpr_realloc(calld->waiting_ops,
|
836
|
-
calld->waiting_ops_capacity * sizeof(*calld->waiting_ops));
|
837
|
-
}
|
838
|
-
calld->waiting_ops[calld->waiting_ops_count++] = op;
|
839
|
-
GPR_TIMER_END("add_waiting_locked", 0);
|
885
|
+
static void waiting_for_pick_batches_add_locked(
|
886
|
+
call_data *calld, grpc_transport_stream_op_batch *batch) {
|
887
|
+
GPR_ASSERT(calld->waiting_for_pick_batches_count < MAX_WAITING_BATCHES);
|
888
|
+
calld->waiting_for_pick_batches[calld->waiting_for_pick_batches_count++] =
|
889
|
+
batch;
|
840
890
|
}
|
841
891
|
|
842
|
-
static void
|
843
|
-
|
844
|
-
|
845
|
-
|
892
|
+
static void waiting_for_pick_batches_fail_locked(grpc_exec_ctx *exec_ctx,
|
893
|
+
grpc_call_element *elem,
|
894
|
+
grpc_error *error) {
|
895
|
+
call_data *calld = elem->call_data;
|
896
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
897
|
+
gpr_log(GPR_DEBUG,
|
898
|
+
"chand=%p calld=%p: failing %" PRIdPTR " pending batches: %s",
|
899
|
+
elem->channel_data, calld, calld->waiting_for_pick_batches_count,
|
900
|
+
grpc_error_string(error));
|
901
|
+
}
|
902
|
+
for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) {
|
846
903
|
grpc_transport_stream_op_batch_finish_with_failure(
|
847
|
-
exec_ctx, calld->
|
904
|
+
exec_ctx, calld->waiting_for_pick_batches[i], GRPC_ERROR_REF(error));
|
848
905
|
}
|
849
|
-
calld->
|
906
|
+
calld->waiting_for_pick_batches_count = 0;
|
850
907
|
GRPC_ERROR_UNREF(error);
|
851
908
|
}
|
852
909
|
|
853
|
-
static void
|
854
|
-
|
910
|
+
static void waiting_for_pick_batches_resume_locked(grpc_exec_ctx *exec_ctx,
|
911
|
+
grpc_call_element *elem) {
|
912
|
+
call_data *calld = elem->call_data;
|
913
|
+
if (calld->waiting_for_pick_batches_count == 0) return;
|
914
|
+
call_or_error coe = get_call_or_error(calld);
|
915
|
+
if (coe.error != GRPC_ERROR_NONE) {
|
916
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem,
|
917
|
+
GRPC_ERROR_REF(coe.error));
|
855
918
|
return;
|
856
919
|
}
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
fail_locked(exec_ctx, calld, GRPC_ERROR_CANCELLED);
|
863
|
-
return;
|
920
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
921
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: sending %" PRIdPTR
|
922
|
+
" pending batches to subchannel_call=%p",
|
923
|
+
elem->channel_data, calld, calld->waiting_for_pick_batches_count,
|
924
|
+
coe.subchannel_call);
|
864
925
|
}
|
865
|
-
calld->
|
866
|
-
|
867
|
-
|
868
|
-
for (size_t i = 0; i < nops; i++) {
|
869
|
-
grpc_subchannel_call_process_op(exec_ctx, call, ops[i]);
|
926
|
+
for (size_t i = 0; i < calld->waiting_for_pick_batches_count; ++i) {
|
927
|
+
grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call,
|
928
|
+
calld->waiting_for_pick_batches[i]);
|
870
929
|
}
|
871
|
-
|
930
|
+
calld->waiting_for_pick_batches_count = 0;
|
872
931
|
}
|
873
932
|
|
874
|
-
//
|
875
|
-
//
|
876
|
-
|
877
|
-
|
878
|
-
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
879
|
-
gpr_timespec *per_method_deadline) {
|
933
|
+
// Applies service config to the call. Must be invoked once we know
|
934
|
+
// that the resolver has returned results to the channel.
|
935
|
+
static void apply_service_config_to_call_locked(grpc_exec_ctx *exec_ctx,
|
936
|
+
grpc_call_element *elem) {
|
880
937
|
channel_data *chand = elem->channel_data;
|
881
938
|
call_data *calld = elem->call_data;
|
939
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
940
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: applying service config to call",
|
941
|
+
chand, calld);
|
942
|
+
}
|
882
943
|
if (chand->retry_throttle_data != NULL) {
|
883
944
|
calld->retry_throttle_data =
|
884
945
|
grpc_server_retry_throttle_data_ref(chand->retry_throttle_data);
|
@@ -888,178 +949,283 @@ static bool set_call_method_params_from_service_config_locked(
|
|
888
949
|
exec_ctx, chand->method_params_table, calld->path);
|
889
950
|
if (calld->method_params != NULL) {
|
890
951
|
method_parameters_ref(calld->method_params);
|
891
|
-
|
952
|
+
// If the deadline from the service config is shorter than the one
|
953
|
+
// from the client API, reset the deadline timer.
|
954
|
+
if (chand->deadline_checking_enabled &&
|
955
|
+
gpr_time_cmp(calld->method_params->timeout,
|
892
956
|
gpr_time_0(GPR_TIMESPAN)) != 0) {
|
893
|
-
|
957
|
+
const gpr_timespec per_method_deadline =
|
894
958
|
gpr_time_add(calld->call_start_time, calld->method_params->timeout);
|
895
|
-
|
959
|
+
if (gpr_time_cmp(per_method_deadline, calld->deadline) < 0) {
|
960
|
+
calld->deadline = per_method_deadline;
|
961
|
+
grpc_deadline_state_reset(exec_ctx, elem, calld->deadline);
|
962
|
+
}
|
896
963
|
}
|
897
964
|
}
|
898
965
|
}
|
899
|
-
return false;
|
900
966
|
}
|
901
967
|
|
902
|
-
static void
|
903
|
-
|
904
|
-
|
905
|
-
* certain it exists) */
|
968
|
+
static void create_subchannel_call_locked(grpc_exec_ctx *exec_ctx,
|
969
|
+
grpc_call_element *elem,
|
970
|
+
grpc_error *error) {
|
906
971
|
call_data *calld = elem->call_data;
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
972
|
+
grpc_subchannel_call *subchannel_call = NULL;
|
973
|
+
const grpc_connected_subchannel_call_args call_args = {
|
974
|
+
.pollent = calld->pollent,
|
975
|
+
.path = calld->path,
|
976
|
+
.start_time = calld->call_start_time,
|
977
|
+
.deadline = calld->deadline,
|
978
|
+
.arena = calld->arena,
|
979
|
+
.context = calld->subchannel_call_context};
|
980
|
+
grpc_error *new_error = grpc_connected_subchannel_create_call(
|
981
|
+
exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call);
|
982
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
983
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: create subchannel_call=%p: error=%s",
|
984
|
+
elem->channel_data, calld, subchannel_call,
|
985
|
+
grpc_error_string(new_error));
|
986
|
+
}
|
987
|
+
GPR_ASSERT(set_call_or_error(
|
988
|
+
calld, (call_or_error){.subchannel_call = subchannel_call}));
|
989
|
+
if (new_error != GRPC_ERROR_NONE) {
|
990
|
+
new_error = grpc_error_add_child(new_error, error);
|
991
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem, new_error);
|
992
|
+
} else {
|
993
|
+
waiting_for_pick_batches_resume_locked(exec_ctx, elem);
|
918
994
|
}
|
995
|
+
GRPC_ERROR_UNREF(error);
|
919
996
|
}
|
920
997
|
|
921
|
-
static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx,
|
998
|
+
static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx,
|
999
|
+
grpc_call_element *elem,
|
922
1000
|
grpc_error *error) {
|
923
|
-
grpc_call_element *elem = arg;
|
924
1001
|
call_data *calld = elem->call_data;
|
925
1002
|
channel_data *chand = elem->channel_data;
|
926
|
-
GPR_ASSERT(calld->pick_pending);
|
927
|
-
calld->pick_pending = false;
|
928
1003
|
grpc_polling_entity_del_from_pollset_set(exec_ctx, calld->pollent,
|
929
1004
|
chand->interested_parties);
|
1005
|
+
call_or_error coe = get_call_or_error(calld);
|
930
1006
|
if (calld->connected_subchannel == NULL) {
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1007
|
+
// Failed to create subchannel.
|
1008
|
+
grpc_error *failure =
|
1009
|
+
error == GRPC_ERROR_NONE
|
1010
|
+
? GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1011
|
+
"Call dropped by load balancing policy")
|
1012
|
+
: GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1013
|
+
"Failed to create subchannel", &error, 1);
|
1014
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1015
|
+
gpr_log(GPR_DEBUG,
|
1016
|
+
"chand=%p calld=%p: failed to create subchannel: error=%s", chand,
|
1017
|
+
calld, grpc_error_string(failure));
|
1018
|
+
}
|
1019
|
+
set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(failure)});
|
1020
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem, failure);
|
1021
|
+
} else if (coe.error != GRPC_ERROR_NONE) {
|
939
1022
|
/* already cancelled before subchannel became ready */
|
1023
|
+
grpc_error *child_errors[] = {error, coe.error};
|
940
1024
|
grpc_error *cancellation_error =
|
941
1025
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
942
|
-
"Cancelled before creating subchannel",
|
1026
|
+
"Cancelled before creating subchannel", child_errors,
|
1027
|
+
GPR_ARRAY_SIZE(child_errors));
|
943
1028
|
/* if due to deadline, attach the deadline exceeded status to the error */
|
944
1029
|
if (gpr_time_cmp(calld->deadline, gpr_now(GPR_CLOCK_MONOTONIC)) < 0) {
|
945
1030
|
cancellation_error =
|
946
1031
|
grpc_error_set_int(cancellation_error, GRPC_ERROR_INT_GRPC_STATUS,
|
947
1032
|
GRPC_STATUS_DEADLINE_EXCEEDED);
|
948
1033
|
}
|
949
|
-
|
1034
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1035
|
+
gpr_log(GPR_DEBUG,
|
1036
|
+
"chand=%p calld=%p: cancelled before subchannel became ready: %s",
|
1037
|
+
chand, calld, grpc_error_string(cancellation_error));
|
1038
|
+
}
|
1039
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem, cancellation_error);
|
950
1040
|
} else {
|
951
1041
|
/* Create call on subchannel. */
|
952
|
-
|
953
|
-
const grpc_connected_subchannel_call_args call_args = {
|
954
|
-
.pollent = calld->pollent,
|
955
|
-
.path = calld->path,
|
956
|
-
.start_time = calld->call_start_time,
|
957
|
-
.deadline = calld->deadline,
|
958
|
-
.arena = calld->arena,
|
959
|
-
.context = calld->subchannel_call_context};
|
960
|
-
grpc_error *new_error = grpc_connected_subchannel_create_call(
|
961
|
-
exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call);
|
962
|
-
gpr_atm_rel_store(&calld->subchannel_call,
|
963
|
-
(gpr_atm)(uintptr_t)subchannel_call);
|
964
|
-
if (new_error != GRPC_ERROR_NONE) {
|
965
|
-
new_error = grpc_error_add_child(new_error, error);
|
966
|
-
fail_locked(exec_ctx, calld, new_error);
|
967
|
-
} else {
|
968
|
-
retry_waiting_locked(exec_ctx, calld);
|
969
|
-
}
|
1042
|
+
create_subchannel_call_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
|
970
1043
|
}
|
971
1044
|
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel");
|
1045
|
+
GRPC_ERROR_UNREF(error);
|
972
1046
|
}
|
973
1047
|
|
974
1048
|
static char *cc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
|
975
1049
|
call_data *calld = elem->call_data;
|
976
|
-
grpc_subchannel_call *subchannel_call =
|
977
|
-
|
1050
|
+
grpc_subchannel_call *subchannel_call =
|
1051
|
+
get_call_or_error(calld).subchannel_call;
|
1052
|
+
if (subchannel_call == NULL) {
|
978
1053
|
return NULL;
|
979
1054
|
} else {
|
980
1055
|
return grpc_subchannel_call_get_peer(exec_ctx, subchannel_call);
|
981
1056
|
}
|
982
1057
|
}
|
983
1058
|
|
1059
|
+
/** Return true if subchannel is available immediately (in which case
|
1060
|
+
subchannel_ready_locked() should not be called), or false otherwise (in
|
1061
|
+
which case subchannel_ready_locked() should be called when the subchannel
|
1062
|
+
is available). */
|
1063
|
+
static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx,
|
1064
|
+
grpc_call_element *elem);
|
1065
|
+
|
984
1066
|
typedef struct {
|
985
|
-
grpc_metadata_batch *initial_metadata;
|
986
|
-
uint32_t initial_metadata_flags;
|
987
|
-
grpc_connected_subchannel **connected_subchannel;
|
988
|
-
grpc_call_context_element *subchannel_call_context;
|
989
|
-
grpc_closure *on_ready;
|
990
1067
|
grpc_call_element *elem;
|
1068
|
+
bool cancelled;
|
991
1069
|
grpc_closure closure;
|
992
|
-
}
|
1070
|
+
} pick_after_resolver_result_args;
|
993
1071
|
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
grpc_metadata_batch *initial_metadata, uint32_t initial_metadata_flags,
|
1000
|
-
grpc_connected_subchannel **connected_subchannel,
|
1001
|
-
grpc_call_context_element *subchannel_call_context, grpc_closure *on_ready);
|
1002
|
-
|
1003
|
-
static void continue_picking_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1004
|
-
grpc_error *error) {
|
1005
|
-
continue_picking_args *cpa = arg;
|
1006
|
-
if (cpa->connected_subchannel == NULL) {
|
1072
|
+
static void pick_after_resolver_result_done_locked(grpc_exec_ctx *exec_ctx,
|
1073
|
+
void *arg,
|
1074
|
+
grpc_error *error) {
|
1075
|
+
pick_after_resolver_result_args *args = arg;
|
1076
|
+
if (args->cancelled) {
|
1007
1077
|
/* cancelled, do nothing */
|
1008
|
-
|
1009
|
-
|
1078
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1079
|
+
gpr_log(GPR_DEBUG, "call cancelled before resolver result");
|
1080
|
+
}
|
1010
1081
|
} else {
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1082
|
+
channel_data *chand = args->elem->channel_data;
|
1083
|
+
call_data *calld = args->elem->call_data;
|
1084
|
+
if (error != GRPC_ERROR_NONE) {
|
1085
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1086
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver failed to return data",
|
1087
|
+
chand, calld);
|
1088
|
+
}
|
1089
|
+
subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_REF(error));
|
1090
|
+
} else {
|
1091
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1092
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver returned, doing pick",
|
1093
|
+
chand, calld);
|
1094
|
+
}
|
1095
|
+
if (pick_subchannel_locked(exec_ctx, args->elem)) {
|
1096
|
+
subchannel_ready_locked(exec_ctx, args->elem, GRPC_ERROR_NONE);
|
1097
|
+
}
|
1016
1098
|
}
|
1017
1099
|
}
|
1018
|
-
gpr_free(
|
1100
|
+
gpr_free(args);
|
1019
1101
|
}
|
1020
1102
|
|
1021
|
-
static void
|
1022
|
-
|
1103
|
+
static void pick_after_resolver_result_start_locked(grpc_exec_ctx *exec_ctx,
|
1104
|
+
grpc_call_element *elem) {
|
1023
1105
|
channel_data *chand = elem->channel_data;
|
1024
1106
|
call_data *calld = elem->call_data;
|
1025
|
-
if (
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
}
|
1030
|
-
|
1107
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1108
|
+
gpr_log(GPR_DEBUG,
|
1109
|
+
"chand=%p calld=%p: deferring pick pending resolver result", chand,
|
1110
|
+
calld);
|
1111
|
+
}
|
1112
|
+
pick_after_resolver_result_args *args =
|
1113
|
+
(pick_after_resolver_result_args *)gpr_zalloc(sizeof(*args));
|
1114
|
+
args->elem = elem;
|
1115
|
+
GRPC_CLOSURE_INIT(&args->closure, pick_after_resolver_result_done_locked,
|
1116
|
+
args, grpc_combiner_scheduler(chand->combiner));
|
1117
|
+
grpc_closure_list_append(&chand->waiting_for_resolver_result_closures,
|
1118
|
+
&args->closure, GRPC_ERROR_NONE);
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
static void pick_after_resolver_result_cancel_locked(grpc_exec_ctx *exec_ctx,
|
1122
|
+
grpc_call_element *elem,
|
1123
|
+
grpc_error *error) {
|
1124
|
+
channel_data *chand = elem->channel_data;
|
1125
|
+
call_data *calld = elem->call_data;
|
1126
|
+
// If we don't yet have a resolver result, then a closure for
|
1127
|
+
// pick_after_resolver_result_done_locked() will have been added to
|
1128
|
+
// chand->waiting_for_resolver_result_closures, and it may not be invoked
|
1129
|
+
// until after this call has been destroyed. We mark the operation as
|
1130
|
+
// cancelled, so that when pick_after_resolver_result_done_locked()
|
1131
|
+
// is called, it will be a no-op. We also immediately invoke
|
1132
|
+
// subchannel_ready_locked() to propagate the error back to the caller.
|
1133
|
+
for (grpc_closure *closure = chand->waiting_for_resolver_result_closures.head;
|
1031
1134
|
closure != NULL; closure = closure->next_data.next) {
|
1032
|
-
|
1033
|
-
if (
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1135
|
+
pick_after_resolver_result_args *args = closure->cb_arg;
|
1136
|
+
if (!args->cancelled && args->elem == elem) {
|
1137
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1138
|
+
gpr_log(GPR_DEBUG,
|
1139
|
+
"chand=%p calld=%p: "
|
1140
|
+
"cancelling pick waiting for resolver result",
|
1141
|
+
chand, calld);
|
1142
|
+
}
|
1143
|
+
args->cancelled = true;
|
1144
|
+
subchannel_ready_locked(exec_ctx, elem,
|
1145
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1146
|
+
"Pick cancelled", &error, 1));
|
1038
1147
|
}
|
1039
1148
|
}
|
1040
1149
|
GRPC_ERROR_UNREF(error);
|
1041
1150
|
}
|
1042
1151
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1152
|
+
// Callback invoked by grpc_lb_policy_pick_locked() for async picks.
|
1153
|
+
// Unrefs the LB policy after invoking subchannel_ready_locked().
|
1154
|
+
static void pick_callback_done_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1155
|
+
grpc_error *error) {
|
1156
|
+
grpc_call_element *elem = arg;
|
1157
|
+
channel_data *chand = elem->channel_data;
|
1158
|
+
call_data *calld = elem->call_data;
|
1159
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1160
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: pick completed asynchronously",
|
1161
|
+
chand, calld);
|
1162
|
+
}
|
1163
|
+
GPR_ASSERT(calld->lb_policy != NULL);
|
1164
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
|
1165
|
+
calld->lb_policy = NULL;
|
1166
|
+
subchannel_ready_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
|
1167
|
+
}
|
1050
1168
|
|
1169
|
+
// Takes a ref to chand->lb_policy and calls grpc_lb_policy_pick_locked().
|
1170
|
+
// If the pick was completed synchronously, unrefs the LB policy and
|
1171
|
+
// returns true.
|
1172
|
+
static bool pick_callback_start_locked(grpc_exec_ctx *exec_ctx,
|
1173
|
+
grpc_call_element *elem,
|
1174
|
+
const grpc_lb_policy_pick_args *inputs) {
|
1051
1175
|
channel_data *chand = elem->channel_data;
|
1052
1176
|
call_data *calld = elem->call_data;
|
1177
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1178
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: starting pick on lb_policy=%p",
|
1179
|
+
chand, calld, chand->lb_policy);
|
1180
|
+
}
|
1181
|
+
// Keep a ref to the LB policy in calld while the pick is pending.
|
1182
|
+
GRPC_LB_POLICY_REF(chand->lb_policy, "pick_subchannel");
|
1183
|
+
calld->lb_policy = chand->lb_policy;
|
1184
|
+
GRPC_CLOSURE_INIT(&calld->lb_pick_closure, pick_callback_done_locked, elem,
|
1185
|
+
grpc_combiner_scheduler(chand->combiner));
|
1186
|
+
const bool pick_done = grpc_lb_policy_pick_locked(
|
1187
|
+
exec_ctx, chand->lb_policy, inputs, &calld->connected_subchannel,
|
1188
|
+
calld->subchannel_call_context, NULL, &calld->lb_pick_closure);
|
1189
|
+
if (pick_done) {
|
1190
|
+
/* synchronous grpc_lb_policy_pick call. Unref the LB policy. */
|
1191
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1192
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: pick completed synchronously",
|
1193
|
+
chand, calld);
|
1194
|
+
}
|
1195
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
|
1196
|
+
calld->lb_policy = NULL;
|
1197
|
+
}
|
1198
|
+
return pick_done;
|
1199
|
+
}
|
1053
1200
|
|
1054
|
-
|
1201
|
+
static void pick_callback_cancel_locked(grpc_exec_ctx *exec_ctx,
|
1202
|
+
grpc_call_element *elem,
|
1203
|
+
grpc_error *error) {
|
1204
|
+
channel_data *chand = elem->channel_data;
|
1205
|
+
call_data *calld = elem->call_data;
|
1206
|
+
GPR_ASSERT(calld->lb_policy != NULL);
|
1207
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1208
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: cancelling pick from LB policy %p",
|
1209
|
+
chand, calld, calld->lb_policy);
|
1210
|
+
}
|
1211
|
+
grpc_lb_policy_cancel_pick_locked(exec_ctx, calld->lb_policy,
|
1212
|
+
&calld->connected_subchannel, error);
|
1213
|
+
}
|
1055
1214
|
|
1215
|
+
static bool pick_subchannel_locked(grpc_exec_ctx *exec_ctx,
|
1216
|
+
grpc_call_element *elem) {
|
1217
|
+
GPR_TIMER_BEGIN("pick_subchannel", 0);
|
1218
|
+
channel_data *chand = elem->channel_data;
|
1219
|
+
call_data *calld = elem->call_data;
|
1220
|
+
bool pick_done = false;
|
1056
1221
|
if (chand->lb_policy != NULL) {
|
1057
|
-
|
1058
|
-
grpc_lb_policy *lb_policy = chand->lb_policy;
|
1059
|
-
GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel");
|
1222
|
+
apply_service_config_to_call_locked(exec_ctx, elem);
|
1060
1223
|
// If the application explicitly set wait_for_ready, use that.
|
1061
1224
|
// Otherwise, if the service config specified a value for this
|
1062
1225
|
// method, use that.
|
1226
|
+
uint32_t initial_metadata_flags =
|
1227
|
+
calld->initial_metadata_payload->send_initial_metadata
|
1228
|
+
.send_initial_metadata_flags;
|
1063
1229
|
const bool wait_for_ready_set_from_api =
|
1064
1230
|
initial_metadata_flags &
|
1065
1231
|
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
|
@@ -1075,169 +1241,108 @@ static bool pick_subchannel_locked(
|
|
1075
1241
|
}
|
1076
1242
|
}
|
1077
1243
|
const grpc_lb_policy_pick_args inputs = {
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
wrapped_on_pick_closure_cb, w_on_pick_arg,
|
1086
|
-
grpc_schedule_on_exec_ctx);
|
1087
|
-
w_on_pick_arg->wrapped_closure = on_ready;
|
1088
|
-
GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel_wrapping");
|
1089
|
-
w_on_pick_arg->lb_policy = lb_policy;
|
1090
|
-
const bool pick_done = grpc_lb_policy_pick_locked(
|
1091
|
-
exec_ctx, lb_policy, &inputs, connected_subchannel,
|
1092
|
-
subchannel_call_context, NULL, &w_on_pick_arg->wrapper_closure);
|
1093
|
-
if (pick_done) {
|
1094
|
-
/* synchronous grpc_lb_policy_pick call. Unref the LB policy. */
|
1095
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, w_on_pick_arg->lb_policy,
|
1096
|
-
"pick_subchannel_wrapping");
|
1097
|
-
gpr_free(w_on_pick_arg);
|
1244
|
+
calld->initial_metadata_payload->send_initial_metadata
|
1245
|
+
.send_initial_metadata,
|
1246
|
+
initial_metadata_flags, &calld->lb_token_mdelem};
|
1247
|
+
pick_done = pick_callback_start_locked(exec_ctx, elem, &inputs);
|
1248
|
+
} else if (chand->resolver != NULL) {
|
1249
|
+
if (!chand->started_resolving) {
|
1250
|
+
start_resolving_locked(exec_ctx, chand);
|
1098
1251
|
}
|
1099
|
-
|
1100
|
-
GPR_TIMER_END("pick_subchannel", 0);
|
1101
|
-
return pick_done;
|
1102
|
-
}
|
1103
|
-
if (chand->resolver != NULL && !chand->started_resolving) {
|
1104
|
-
chand->started_resolving = true;
|
1105
|
-
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
|
1106
|
-
grpc_resolver_next_locked(exec_ctx, chand->resolver,
|
1107
|
-
&chand->resolver_result,
|
1108
|
-
&chand->on_resolver_result_changed);
|
1109
|
-
}
|
1110
|
-
if (chand->resolver != NULL) {
|
1111
|
-
continue_picking_args *cpa = gpr_malloc(sizeof(*cpa));
|
1112
|
-
cpa->initial_metadata = initial_metadata;
|
1113
|
-
cpa->initial_metadata_flags = initial_metadata_flags;
|
1114
|
-
cpa->connected_subchannel = connected_subchannel;
|
1115
|
-
cpa->subchannel_call_context = subchannel_call_context;
|
1116
|
-
cpa->on_ready = on_ready;
|
1117
|
-
cpa->elem = elem;
|
1118
|
-
grpc_closure_init(&cpa->closure, continue_picking_locked, cpa,
|
1119
|
-
grpc_combiner_scheduler(chand->combiner, true));
|
1120
|
-
grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure,
|
1121
|
-
GRPC_ERROR_NONE);
|
1252
|
+
pick_after_resolver_result_start_locked(exec_ctx, elem);
|
1122
1253
|
} else {
|
1123
|
-
|
1124
|
-
|
1254
|
+
subchannel_ready_locked(
|
1255
|
+
exec_ctx, elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected"));
|
1125
1256
|
}
|
1126
|
-
|
1127
1257
|
GPR_TIMER_END("pick_subchannel", 0);
|
1128
|
-
return
|
1258
|
+
return pick_done;
|
1129
1259
|
}
|
1130
1260
|
|
1131
|
-
static void
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1261
|
+
static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx,
|
1262
|
+
void *arg,
|
1263
|
+
grpc_error *error_ignored) {
|
1264
|
+
GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0);
|
1265
|
+
grpc_transport_stream_op_batch *batch = arg;
|
1266
|
+
grpc_call_element *elem = batch->handler_private.extra_arg;
|
1135
1267
|
call_data *calld = elem->call_data;
|
1136
|
-
|
1137
|
-
|
1268
|
+
channel_data *chand = elem->channel_data;
|
1138
1269
|
/* need to recheck that another thread hasn't set the call */
|
1139
|
-
|
1140
|
-
if (
|
1270
|
+
call_or_error coe = get_call_or_error(calld);
|
1271
|
+
if (coe.error != GRPC_ERROR_NONE) {
|
1272
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1273
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: failing batch with error: %s",
|
1274
|
+
chand, calld, grpc_error_string(coe.error));
|
1275
|
+
}
|
1141
1276
|
grpc_transport_stream_op_batch_finish_with_failure(
|
1142
|
-
exec_ctx,
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1277
|
+
exec_ctx, batch, GRPC_ERROR_REF(coe.error));
|
1278
|
+
goto done;
|
1279
|
+
}
|
1280
|
+
if (coe.subchannel_call != NULL) {
|
1281
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1282
|
+
gpr_log(GPR_DEBUG,
|
1283
|
+
"chand=%p calld=%p: sending batch to subchannel_call=%p", chand,
|
1284
|
+
calld, coe.subchannel_call);
|
1285
|
+
}
|
1286
|
+
grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, batch);
|
1287
|
+
goto done;
|
1288
|
+
}
|
1289
|
+
// Add to waiting-for-pick list. If we succeed in getting a
|
1290
|
+
// subchannel call below, we'll handle this batch (along with any
|
1291
|
+
// other waiting batches) in waiting_for_pick_batches_resume_locked().
|
1292
|
+
waiting_for_pick_batches_add_locked(calld, batch);
|
1293
|
+
// If this is a cancellation, cancel the pending pick (if any) and
|
1294
|
+
// fail any pending batches.
|
1295
|
+
if (batch->cancel_stream) {
|
1296
|
+
grpc_error *error = batch->payload->cancel_stream.cancel_error;
|
1297
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1298
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: recording cancel_error=%s", chand,
|
1299
|
+
calld, grpc_error_string(error));
|
1300
|
+
}
|
1301
|
+
/* Stash a copy of cancel_error in our call data, so that we can use
|
1302
|
+
it for subsequent operations. This ensures that if the call is
|
1303
|
+
cancelled before any batches are passed down (e.g., if the deadline
|
1304
|
+
is in the past when the call starts), we can return the right
|
1305
|
+
error to the caller when the first batch does get passed down. */
|
1306
|
+
set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)});
|
1307
|
+
if (calld->lb_policy != NULL) {
|
1308
|
+
pick_callback_cancel_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
|
1159
1309
|
} else {
|
1160
|
-
|
1161
|
-
|
1162
|
-
cancelled before any ops are passed down (e.g., if the deadline
|
1163
|
-
is in the past when the call starts), we can return the right
|
1164
|
-
error to the caller when the first op does get passed down. */
|
1165
|
-
calld->cancel_error =
|
1166
|
-
GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error);
|
1167
|
-
if (calld->pick_pending) {
|
1168
|
-
cancel_pick_locked(
|
1169
|
-
exec_ctx, elem,
|
1170
|
-
GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error));
|
1171
|
-
} else {
|
1172
|
-
fail_locked(exec_ctx, calld,
|
1173
|
-
GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error));
|
1174
|
-
}
|
1175
|
-
grpc_transport_stream_op_batch_finish_with_failure(
|
1176
|
-
exec_ctx, op,
|
1177
|
-
GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error));
|
1178
|
-
/* early out */
|
1179
|
-
return;
|
1310
|
+
pick_after_resolver_result_cancel_locked(exec_ctx, elem,
|
1311
|
+
GRPC_ERROR_REF(error));
|
1180
1312
|
}
|
1313
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
|
1314
|
+
goto done;
|
1181
1315
|
}
|
1182
1316
|
/* if we don't have a subchannel, try to get one */
|
1183
|
-
if (
|
1184
|
-
|
1185
|
-
calld->
|
1186
|
-
grpc_closure_init(&calld->next_step, subchannel_ready_locked, elem,
|
1187
|
-
grpc_combiner_scheduler(chand->combiner, true));
|
1317
|
+
if (batch->send_initial_metadata) {
|
1318
|
+
GPR_ASSERT(calld->connected_subchannel == NULL);
|
1319
|
+
calld->initial_metadata_payload = batch->payload;
|
1188
1320
|
GRPC_CALL_STACK_REF(calld->owning_call, "pick_subchannel");
|
1189
1321
|
/* If a subchannel is not available immediately, the polling entity from
|
1190
1322
|
call_data should be provided to channel_data's interested_parties, so
|
1191
1323
|
that IO of the lb_policy and resolver could be done under it. */
|
1192
|
-
if (pick_subchannel_locked(
|
1193
|
-
|
1194
|
-
op->payload->send_initial_metadata.send_initial_metadata,
|
1195
|
-
op->payload->send_initial_metadata.send_initial_metadata_flags,
|
1196
|
-
&calld->connected_subchannel, calld->subchannel_call_context,
|
1197
|
-
&calld->next_step)) {
|
1198
|
-
calld->pick_pending = false;
|
1324
|
+
if (pick_subchannel_locked(exec_ctx, elem)) {
|
1325
|
+
// Pick was returned synchronously.
|
1199
1326
|
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel");
|
1200
1327
|
if (calld->connected_subchannel == NULL) {
|
1201
|
-
gpr_atm_no_barrier_store(&calld->subchannel_call,
|
1202
|
-
(gpr_atm)CANCELLED_CALL);
|
1203
1328
|
grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1204
1329
|
"Call dropped by load balancing policy");
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1330
|
+
set_call_or_error(calld,
|
1331
|
+
(call_or_error){.error = GRPC_ERROR_REF(error)});
|
1332
|
+
waiting_for_pick_batches_fail_locked(exec_ctx, elem, error);
|
1333
|
+
} else {
|
1334
|
+
// Create subchannel call.
|
1335
|
+
create_subchannel_call_locked(exec_ctx, elem, GRPC_ERROR_NONE);
|
1208
1336
|
}
|
1209
1337
|
} else {
|
1210
1338
|
grpc_polling_entity_add_to_pollset_set(exec_ctx, calld->pollent,
|
1211
1339
|
chand->interested_parties);
|
1212
1340
|
}
|
1213
1341
|
}
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
.pollent = calld->pollent,
|
1219
|
-
.path = calld->path,
|
1220
|
-
.start_time = calld->call_start_time,
|
1221
|
-
.deadline = calld->deadline,
|
1222
|
-
.arena = calld->arena,
|
1223
|
-
.context = calld->subchannel_call_context};
|
1224
|
-
grpc_error *error = grpc_connected_subchannel_create_call(
|
1225
|
-
exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call);
|
1226
|
-
gpr_atm_rel_store(&calld->subchannel_call,
|
1227
|
-
(gpr_atm)(uintptr_t)subchannel_call);
|
1228
|
-
if (error != GRPC_ERROR_NONE) {
|
1229
|
-
fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error));
|
1230
|
-
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error);
|
1231
|
-
} else {
|
1232
|
-
retry_waiting_locked(exec_ctx, calld);
|
1233
|
-
/* recurse to retry */
|
1234
|
-
start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem);
|
1235
|
-
}
|
1236
|
-
/* early out */
|
1237
|
-
return;
|
1238
|
-
}
|
1239
|
-
/* nothing to be done but wait */
|
1240
|
-
add_waiting_locked(calld, op);
|
1342
|
+
done:
|
1343
|
+
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call,
|
1344
|
+
"start_transport_stream_op_batch");
|
1345
|
+
GPR_TIMER_END("start_transport_stream_op_batch_locked", 0);
|
1241
1346
|
}
|
1242
1347
|
|
1243
1348
|
static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
@@ -1256,34 +1361,10 @@ static void on_complete(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|
1256
1361
|
calld->retry_throttle_data);
|
1257
1362
|
}
|
1258
1363
|
}
|
1259
|
-
|
1364
|
+
GRPC_CLOSURE_RUN(exec_ctx, calld->original_on_complete,
|
1260
1365
|
GRPC_ERROR_REF(error));
|
1261
1366
|
}
|
1262
1367
|
|
1263
|
-
static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx,
|
1264
|
-
void *arg,
|
1265
|
-
grpc_error *error_ignored) {
|
1266
|
-
GPR_TIMER_BEGIN("start_transport_stream_op_batch_locked", 0);
|
1267
|
-
|
1268
|
-
grpc_transport_stream_op_batch *op = arg;
|
1269
|
-
grpc_call_element *elem = op->handler_private.extra_arg;
|
1270
|
-
call_data *calld = elem->call_data;
|
1271
|
-
|
1272
|
-
if (op->recv_trailing_metadata) {
|
1273
|
-
GPR_ASSERT(op->on_complete != NULL);
|
1274
|
-
calld->original_on_complete = op->on_complete;
|
1275
|
-
grpc_closure_init(&calld->on_complete, on_complete, elem,
|
1276
|
-
grpc_schedule_on_exec_ctx);
|
1277
|
-
op->on_complete = &calld->on_complete;
|
1278
|
-
}
|
1279
|
-
|
1280
|
-
start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem);
|
1281
|
-
|
1282
|
-
GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call,
|
1283
|
-
"start_transport_stream_op_batch");
|
1284
|
-
GPR_TIMER_END("start_transport_stream_op_batch_locked", 0);
|
1285
|
-
}
|
1286
|
-
|
1287
1368
|
/* The logic here is fairly complicated, due to (a) the fact that we
|
1288
1369
|
need to handle the case where we receive the send op before the
|
1289
1370
|
initial metadata op, and (b) the need for efficiency, especially in
|
@@ -1294,39 +1375,59 @@ static void start_transport_stream_op_batch_locked(grpc_exec_ctx *exec_ctx,
|
|
1294
1375
|
If it has, we proceed on the fast path. */
|
1295
1376
|
static void cc_start_transport_stream_op_batch(
|
1296
1377
|
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
1297
|
-
grpc_transport_stream_op_batch *
|
1378
|
+
grpc_transport_stream_op_batch *batch) {
|
1298
1379
|
call_data *calld = elem->call_data;
|
1299
1380
|
channel_data *chand = elem->channel_data;
|
1300
|
-
|
1381
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace) ||
|
1382
|
+
GRPC_TRACER_ON(grpc_trace_channel)) {
|
1383
|
+
grpc_call_log_op(GPR_INFO, elem, batch);
|
1384
|
+
}
|
1301
1385
|
if (chand->deadline_checking_enabled) {
|
1302
1386
|
grpc_deadline_state_client_start_transport_stream_op_batch(exec_ctx, elem,
|
1303
|
-
|
1387
|
+
batch);
|
1388
|
+
}
|
1389
|
+
// Intercept on_complete for recv_trailing_metadata so that we can
|
1390
|
+
// check retry throttle status.
|
1391
|
+
if (batch->recv_trailing_metadata) {
|
1392
|
+
GPR_ASSERT(batch->on_complete != NULL);
|
1393
|
+
calld->original_on_complete = batch->on_complete;
|
1394
|
+
GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem,
|
1395
|
+
grpc_schedule_on_exec_ctx);
|
1396
|
+
batch->on_complete = &calld->on_complete;
|
1304
1397
|
}
|
1305
1398
|
/* try to (atomically) get the call */
|
1306
|
-
|
1399
|
+
call_or_error coe = get_call_or_error(calld);
|
1307
1400
|
GPR_TIMER_BEGIN("cc_start_transport_stream_op_batch", 0);
|
1308
|
-
if (
|
1401
|
+
if (coe.error != GRPC_ERROR_NONE) {
|
1402
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1403
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: failing batch with error: %s",
|
1404
|
+
chand, calld, grpc_error_string(coe.error));
|
1405
|
+
}
|
1309
1406
|
grpc_transport_stream_op_batch_finish_with_failure(
|
1310
|
-
exec_ctx,
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1407
|
+
exec_ctx, batch, GRPC_ERROR_REF(coe.error));
|
1408
|
+
goto done;
|
1409
|
+
}
|
1410
|
+
if (coe.subchannel_call != NULL) {
|
1411
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1412
|
+
gpr_log(GPR_DEBUG,
|
1413
|
+
"chand=%p calld=%p: sending batch to subchannel_call=%p", chand,
|
1414
|
+
calld, coe.subchannel_call);
|
1415
|
+
}
|
1416
|
+
grpc_subchannel_call_process_op(exec_ctx, coe.subchannel_call, batch);
|
1417
|
+
goto done;
|
1320
1418
|
}
|
1321
1419
|
/* we failed; lock and figure out what to do */
|
1420
|
+
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
|
1421
|
+
gpr_log(GPR_DEBUG, "chand=%p calld=%p: entering combiner", chand, calld);
|
1422
|
+
}
|
1322
1423
|
GRPC_CALL_STACK_REF(calld->owning_call, "start_transport_stream_op_batch");
|
1323
|
-
|
1324
|
-
|
1325
|
-
exec_ctx,
|
1326
|
-
|
1327
|
-
|
1328
|
-
grpc_combiner_scheduler(chand->combiner, false)),
|
1424
|
+
batch->handler_private.extra_arg = elem;
|
1425
|
+
GRPC_CLOSURE_SCHED(
|
1426
|
+
exec_ctx, GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
1427
|
+
start_transport_stream_op_batch_locked, batch,
|
1428
|
+
grpc_combiner_scheduler(chand->combiner)),
|
1329
1429
|
GRPC_ERROR_NONE);
|
1430
|
+
done:
|
1330
1431
|
GPR_TIMER_END("cc_start_transport_stream_op_batch", 0);
|
1331
1432
|
}
|
1332
1433
|
|
@@ -1362,15 +1463,17 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
|
1362
1463
|
if (calld->method_params != NULL) {
|
1363
1464
|
method_parameters_unref(calld->method_params);
|
1364
1465
|
}
|
1365
|
-
|
1366
|
-
|
1367
|
-
if (
|
1368
|
-
grpc_subchannel_call_set_cleanup_closure(
|
1466
|
+
call_or_error coe = get_call_or_error(calld);
|
1467
|
+
GRPC_ERROR_UNREF(coe.error);
|
1468
|
+
if (coe.subchannel_call != NULL) {
|
1469
|
+
grpc_subchannel_call_set_cleanup_closure(coe.subchannel_call,
|
1470
|
+
then_schedule_closure);
|
1369
1471
|
then_schedule_closure = NULL;
|
1370
|
-
GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx,
|
1472
|
+
GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, coe.subchannel_call,
|
1473
|
+
"client_channel_destroy_call");
|
1371
1474
|
}
|
1372
|
-
GPR_ASSERT(
|
1373
|
-
GPR_ASSERT(calld->
|
1475
|
+
GPR_ASSERT(calld->lb_policy == NULL);
|
1476
|
+
GPR_ASSERT(calld->waiting_for_pick_batches_count == 0);
|
1374
1477
|
if (calld->connected_subchannel != NULL) {
|
1375
1478
|
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel,
|
1376
1479
|
"picked");
|
@@ -1381,8 +1484,7 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
|
1381
1484
|
calld->subchannel_call_context[i].value);
|
1382
1485
|
}
|
1383
1486
|
}
|
1384
|
-
|
1385
|
-
grpc_closure_sched(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE);
|
1487
|
+
GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE);
|
1386
1488
|
}
|
1387
1489
|
|
1388
1490
|
static void cc_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
@@ -1419,11 +1521,7 @@ static void try_to_connect_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1419
1521
|
} else {
|
1420
1522
|
chand->exit_idle_when_lb_policy_arrives = true;
|
1421
1523
|
if (!chand->started_resolving && chand->resolver != NULL) {
|
1422
|
-
|
1423
|
-
chand->started_resolving = true;
|
1424
|
-
grpc_resolver_next_locked(exec_ctx, chand->resolver,
|
1425
|
-
&chand->resolver_result,
|
1426
|
-
&chand->on_resolver_result_changed);
|
1524
|
+
start_resolving_locked(exec_ctx, chand);
|
1427
1525
|
}
|
1428
1526
|
}
|
1429
1527
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "try_to_connect");
|
@@ -1436,10 +1534,9 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
|
|
1436
1534
|
grpc_connectivity_state_check(&chand->state_tracker);
|
1437
1535
|
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
|
1438
1536
|
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "try_to_connect");
|
1439
|
-
|
1440
|
-
exec_ctx,
|
1441
|
-
|
1442
|
-
grpc_combiner_scheduler(chand->combiner, false)),
|
1537
|
+
GRPC_CLOSURE_SCHED(
|
1538
|
+
exec_ctx, GRPC_CLOSURE_CREATE(try_to_connect_locked, chand,
|
1539
|
+
grpc_combiner_scheduler(chand->combiner)),
|
1443
1540
|
GRPC_ERROR_NONE);
|
1444
1541
|
}
|
1445
1542
|
return out;
|
@@ -1447,7 +1544,7 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
|
|
1447
1544
|
|
1448
1545
|
typedef struct external_connectivity_watcher {
|
1449
1546
|
channel_data *chand;
|
1450
|
-
|
1547
|
+
grpc_polling_entity pollent;
|
1451
1548
|
grpc_closure *on_complete;
|
1452
1549
|
grpc_closure *watcher_timer_init;
|
1453
1550
|
grpc_connectivity_state *state;
|
@@ -1522,13 +1619,13 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1522
1619
|
grpc_error *error) {
|
1523
1620
|
external_connectivity_watcher *w = arg;
|
1524
1621
|
grpc_closure *follow_up = w->on_complete;
|
1525
|
-
|
1526
|
-
|
1622
|
+
grpc_polling_entity_del_from_pollset_set(exec_ctx, &w->pollent,
|
1623
|
+
w->chand->interested_parties);
|
1527
1624
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
|
1528
1625
|
"external_connectivity_watcher");
|
1529
1626
|
external_connectivity_watcher_list_remove(w->chand, w);
|
1530
1627
|
gpr_free(w);
|
1531
|
-
|
1628
|
+
GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error));
|
1532
1629
|
}
|
1533
1630
|
|
1534
1631
|
static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
@@ -1537,8 +1634,8 @@ static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1537
1634
|
external_connectivity_watcher *found = NULL;
|
1538
1635
|
if (w->state != NULL) {
|
1539
1636
|
external_connectivity_watcher_list_append(w->chand, w);
|
1540
|
-
|
1541
|
-
|
1637
|
+
GRPC_CLOSURE_RUN(exec_ctx, w->watcher_timer_init, GRPC_ERROR_NONE);
|
1638
|
+
GRPC_CLOSURE_INIT(&w->my_closure, on_external_watch_complete, w,
|
1542
1639
|
grpc_schedule_on_exec_ctx);
|
1543
1640
|
grpc_connectivity_state_notify_on_state_change(
|
1544
1641
|
exec_ctx, &w->chand->state_tracker, w->state, &w->my_closure);
|
@@ -1550,8 +1647,8 @@ static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1550
1647
|
grpc_connectivity_state_notify_on_state_change(
|
1551
1648
|
exec_ctx, &found->chand->state_tracker, NULL, &found->my_closure);
|
1552
1649
|
}
|
1553
|
-
|
1554
|
-
|
1650
|
+
grpc_polling_entity_del_from_pollset_set(exec_ctx, &w->pollent,
|
1651
|
+
w->chand->interested_parties);
|
1555
1652
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
|
1556
1653
|
"external_connectivity_watcher");
|
1557
1654
|
gpr_free(w);
|
@@ -1559,23 +1656,23 @@ static void watch_connectivity_state_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1559
1656
|
}
|
1560
1657
|
|
1561
1658
|
void grpc_client_channel_watch_connectivity_state(
|
1562
|
-
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
|
1563
|
-
|
1564
|
-
grpc_closure *watcher_timer_init) {
|
1659
|
+
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
|
1660
|
+
grpc_polling_entity pollent, grpc_connectivity_state *state,
|
1661
|
+
grpc_closure *closure, grpc_closure *watcher_timer_init) {
|
1565
1662
|
channel_data *chand = elem->channel_data;
|
1566
1663
|
external_connectivity_watcher *w = gpr_zalloc(sizeof(*w));
|
1567
1664
|
w->chand = chand;
|
1568
|
-
w->
|
1665
|
+
w->pollent = pollent;
|
1569
1666
|
w->on_complete = closure;
|
1570
1667
|
w->state = state;
|
1571
1668
|
w->watcher_timer_init = watcher_timer_init;
|
1572
|
-
|
1573
|
-
|
1669
|
+
grpc_polling_entity_add_to_pollset_set(exec_ctx, &w->pollent,
|
1670
|
+
chand->interested_parties);
|
1574
1671
|
GRPC_CHANNEL_STACK_REF(w->chand->owning_stack,
|
1575
1672
|
"external_connectivity_watcher");
|
1576
|
-
|
1673
|
+
GRPC_CLOSURE_SCHED(
|
1577
1674
|
exec_ctx,
|
1578
|
-
|
1579
|
-
grpc_combiner_scheduler(chand->combiner
|
1675
|
+
GRPC_CLOSURE_INIT(&w->my_closure, watch_connectivity_state_locked, w,
|
1676
|
+
grpc_combiner_scheduler(chand->combiner)),
|
1580
1677
|
GRPC_ERROR_NONE);
|
1581
1678
|
}
|