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 2017
|
4
|
-
* All rights reserved.
|
3
|
+
* Copyright 2017 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 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
|
|
@@ -115,6 +100,7 @@
|
|
115
100
|
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
116
101
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
117
102
|
#include "src/core/ext/filters/client_channel/parse_address.h"
|
103
|
+
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
|
118
104
|
#include "src/core/lib/channel/channel_args.h"
|
119
105
|
#include "src/core/lib/channel/channel_stack.h"
|
120
106
|
#include "src/core/lib/iomgr/combiner.h"
|
@@ -137,7 +123,7 @@
|
|
137
123
|
#define GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS 120
|
138
124
|
#define GRPC_GRPCLB_RECONNECT_JITTER 0.2
|
139
125
|
|
140
|
-
grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false);
|
126
|
+
grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false, "glb");
|
141
127
|
|
142
128
|
/* add lb_token of selected subchannel (address) to the call's initial
|
143
129
|
* metadata */
|
@@ -198,7 +184,7 @@ static void wrapped_rr_closure(grpc_exec_ctx *exec_ctx, void *arg,
|
|
198
184
|
wrapped_rr_closure_arg *wc_arg = arg;
|
199
185
|
|
200
186
|
GPR_ASSERT(wc_arg->wrapped_closure != NULL);
|
201
|
-
|
187
|
+
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
|
202
188
|
|
203
189
|
if (wc_arg->rr_policy != NULL) {
|
204
190
|
/* if *target is NULL, no pick has been made by the RR policy (eg, all
|
@@ -270,7 +256,7 @@ static void add_pending_pick(pending_pick **root,
|
|
270
256
|
pp->wrapped_on_complete_arg.lb_token_mdelem_storage =
|
271
257
|
pick_args->lb_token_mdelem_storage;
|
272
258
|
pp->wrapped_on_complete_arg.free_when_done = pp;
|
273
|
-
|
259
|
+
GRPC_CLOSURE_INIT(&pp->wrapped_on_complete_arg.wrapper_closure,
|
274
260
|
wrapped_rr_closure, &pp->wrapped_on_complete_arg,
|
275
261
|
grpc_schedule_on_exec_ctx);
|
276
262
|
*root = pp;
|
@@ -289,7 +275,7 @@ static void add_pending_ping(pending_ping **root, grpc_closure *notify) {
|
|
289
275
|
pping->wrapped_notify_arg.wrapped_closure = notify;
|
290
276
|
pping->wrapped_notify_arg.free_when_done = pping;
|
291
277
|
pping->next = *root;
|
292
|
-
|
278
|
+
GRPC_CLOSURE_INIT(&pping->wrapped_notify_arg.wrapper_closure,
|
293
279
|
wrapped_rr_closure, &pping->wrapped_notify_arg,
|
294
280
|
grpc_schedule_on_exec_ctx);
|
295
281
|
*root = pping;
|
@@ -315,6 +301,9 @@ typedef struct glb_lb_policy {
|
|
315
301
|
/** for communicating with the LB server */
|
316
302
|
grpc_channel *lb_channel;
|
317
303
|
|
304
|
+
/** response generator to inject address updates into \a lb_channel */
|
305
|
+
grpc_fake_resolver_response_generator *response_generator;
|
306
|
+
|
318
307
|
/** the RR policy to use of the backend servers returned by the LB server */
|
319
308
|
grpc_lb_policy *rr_policy;
|
320
309
|
|
@@ -323,6 +312,9 @@ typedef struct glb_lb_policy {
|
|
323
312
|
/** our connectivity state tracker */
|
324
313
|
grpc_connectivity_state_tracker state_tracker;
|
325
314
|
|
315
|
+
/** connectivity state of the LB channel */
|
316
|
+
grpc_connectivity_state lb_channel_connectivity;
|
317
|
+
|
326
318
|
/** stores the deserialized response from the LB. May be NULL until one such
|
327
319
|
* response has arrived. */
|
328
320
|
grpc_grpclb_serverlist *serverlist;
|
@@ -340,10 +332,27 @@ typedef struct glb_lb_policy {
|
|
340
332
|
|
341
333
|
bool shutting_down;
|
342
334
|
|
335
|
+
/** are we currently updating lb_call? */
|
336
|
+
bool updating_lb_call;
|
337
|
+
|
338
|
+
/** are we currently updating lb_channel? */
|
339
|
+
bool updating_lb_channel;
|
340
|
+
|
341
|
+
/** are we already watching the LB channel's connectivity? */
|
342
|
+
bool watching_lb_channel;
|
343
|
+
|
344
|
+
/** is \a lb_call_retry_timer active? */
|
345
|
+
bool retry_timer_active;
|
346
|
+
|
347
|
+
/** called upon changes to the LB channel's connectivity. */
|
348
|
+
grpc_closure lb_channel_on_connectivity_changed;
|
349
|
+
|
350
|
+
/** args from the latest update received while already updating, or NULL */
|
351
|
+
grpc_lb_policy_args *pending_update_args;
|
352
|
+
|
343
353
|
/************************************************************/
|
344
354
|
/* client data associated with the LB server communication */
|
345
355
|
/************************************************************/
|
346
|
-
|
347
356
|
/* Finished sending initial request. */
|
348
357
|
grpc_closure lb_on_sent_initial_request;
|
349
358
|
|
@@ -407,9 +416,7 @@ struct rr_connectivity_data {
|
|
407
416
|
|
408
417
|
static bool is_server_valid(const grpc_grpclb_server *server, size_t idx,
|
409
418
|
bool log) {
|
410
|
-
if (server->
|
411
|
-
return false;
|
412
|
-
}
|
419
|
+
if (server->drop) return false;
|
413
420
|
const grpc_grpclb_ip_address *ip = &server->ip_address;
|
414
421
|
if (server->port >> 16 != 0) {
|
415
422
|
if (log) {
|
@@ -453,7 +460,7 @@ static const grpc_lb_user_data_vtable lb_token_vtable = {
|
|
453
460
|
static void parse_server(const grpc_grpclb_server *server,
|
454
461
|
grpc_resolved_address *addr) {
|
455
462
|
memset(addr, 0, sizeof(*addr));
|
456
|
-
if (server->
|
463
|
+
if (server->drop) return;
|
457
464
|
const uint16_t netorder_port = htons((uint16_t)server->port);
|
458
465
|
/* the addresses are given in binary format (a in(6)_addr struct) in
|
459
466
|
* server->ip_address.bytes. */
|
@@ -482,11 +489,8 @@ static grpc_lb_addresses *process_serverlist_locked(
|
|
482
489
|
for (size_t i = 0; i < serverlist->num_servers; ++i) {
|
483
490
|
if (is_server_valid(serverlist->servers[i], i, true)) ++num_valid;
|
484
491
|
}
|
485
|
-
if (num_valid == 0) return NULL;
|
486
|
-
|
487
492
|
grpc_lb_addresses *lb_addresses =
|
488
493
|
grpc_lb_addresses_create(num_valid, &lb_token_vtable);
|
489
|
-
|
490
494
|
/* second pass: actually populate the addresses and LB tokens (aka user data
|
491
495
|
* to the outside world) to be read by the RR policy during its creation.
|
492
496
|
* Given that the validity tests are very cheap, they are performed again
|
@@ -494,14 +498,12 @@ static grpc_lb_addresses *process_serverlist_locked(
|
|
494
498
|
* incurr in an allocation due to the arbitrary number of server */
|
495
499
|
size_t addr_idx = 0;
|
496
500
|
for (size_t sl_idx = 0; sl_idx < serverlist->num_servers; ++sl_idx) {
|
497
|
-
GPR_ASSERT(addr_idx < num_valid);
|
498
501
|
const grpc_grpclb_server *server = serverlist->servers[sl_idx];
|
499
502
|
if (!is_server_valid(serverlist->servers[sl_idx], sl_idx, false)) continue;
|
500
|
-
|
503
|
+
GPR_ASSERT(addr_idx < num_valid);
|
501
504
|
/* address processing */
|
502
505
|
grpc_resolved_address addr;
|
503
506
|
parse_server(server, &addr);
|
504
|
-
|
505
507
|
/* lb token processing */
|
506
508
|
void *user_data;
|
507
509
|
if (server->has_load_balance_token) {
|
@@ -533,10 +535,9 @@ static grpc_lb_addresses *process_serverlist_locked(
|
|
533
535
|
return lb_addresses;
|
534
536
|
}
|
535
537
|
|
536
|
-
|
537
|
-
static bool update_lb_connectivity_status_locked(
|
538
|
+
static void update_lb_connectivity_status_locked(
|
538
539
|
grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy,
|
539
|
-
grpc_connectivity_state
|
540
|
+
grpc_connectivity_state rr_state, grpc_error *rr_state_error) {
|
540
541
|
const grpc_connectivity_state curr_glb_state =
|
541
542
|
grpc_connectivity_state_check(&glb_policy->state_tracker);
|
542
543
|
|
@@ -570,28 +571,26 @@ static bool update_lb_connectivity_status_locked(
|
|
570
571
|
* (*) This function mustn't be called during shutting down. */
|
571
572
|
GPR_ASSERT(curr_glb_state != GRPC_CHANNEL_SHUTDOWN);
|
572
573
|
|
573
|
-
switch (
|
574
|
+
switch (rr_state) {
|
574
575
|
case GRPC_CHANNEL_TRANSIENT_FAILURE:
|
575
576
|
case GRPC_CHANNEL_SHUTDOWN:
|
576
|
-
GPR_ASSERT(
|
577
|
-
|
577
|
+
GPR_ASSERT(rr_state_error != GRPC_ERROR_NONE);
|
578
|
+
break;
|
578
579
|
case GRPC_CHANNEL_INIT:
|
579
580
|
case GRPC_CHANNEL_IDLE:
|
580
581
|
case GRPC_CHANNEL_CONNECTING:
|
581
582
|
case GRPC_CHANNEL_READY:
|
582
|
-
GPR_ASSERT(
|
583
|
+
GPR_ASSERT(rr_state_error == GRPC_ERROR_NONE);
|
583
584
|
}
|
584
585
|
|
585
586
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
586
|
-
gpr_log(
|
587
|
-
|
588
|
-
|
589
|
-
(void *)glb_policy->rr_policy);
|
587
|
+
gpr_log(
|
588
|
+
GPR_INFO, "Setting grpclb's state to %s from new RR policy %p state.",
|
589
|
+
grpc_connectivity_state_name(rr_state), (void *)glb_policy->rr_policy);
|
590
590
|
}
|
591
|
-
grpc_connectivity_state_set(exec_ctx, &glb_policy->state_tracker,
|
592
|
-
|
591
|
+
grpc_connectivity_state_set(exec_ctx, &glb_policy->state_tracker, rr_state,
|
592
|
+
rr_state_error,
|
593
593
|
"update_lb_connectivity_status_locked");
|
594
|
-
return true;
|
595
594
|
}
|
596
595
|
|
597
596
|
/* Perform a pick over \a glb_policy->rr_policy. Given that a pick can return
|
@@ -609,7 +608,7 @@ static bool pick_from_internal_rr_locked(
|
|
609
608
|
if (glb_policy->serverlist_index == glb_policy->serverlist->num_servers) {
|
610
609
|
glb_policy->serverlist_index = 0; // Wrap-around.
|
611
610
|
}
|
612
|
-
if (server->
|
611
|
+
if (server->drop) {
|
613
612
|
// Not using the RR policy, so unref it.
|
614
613
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
615
614
|
gpr_log(GPR_INFO, "Unreffing RR for drop (0x%" PRIxPTR ")",
|
@@ -621,15 +620,12 @@ static bool pick_from_internal_rr_locked(
|
|
621
620
|
// the client_load_reporting filter, because we do not create a
|
622
621
|
// subchannel call (and therefore no client_load_reporting filter)
|
623
622
|
// for dropped calls.
|
624
|
-
|
625
|
-
|
626
|
-
server->drop_for_rate_limiting, server->drop_for_load_balancing,
|
627
|
-
false /* failed_to_send */, false /* known_received */,
|
628
|
-
wc_arg->client_stats);
|
623
|
+
grpc_grpclb_client_stats_add_call_dropped_locked(server->load_balance_token,
|
624
|
+
wc_arg->client_stats);
|
629
625
|
grpc_grpclb_client_stats_unref(wc_arg->client_stats);
|
630
626
|
if (force_async) {
|
631
627
|
GPR_ASSERT(wc_arg->wrapped_closure != NULL);
|
632
|
-
|
628
|
+
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
|
633
629
|
gpr_free(wc_arg->free_when_done);
|
634
630
|
return false;
|
635
631
|
}
|
@@ -657,7 +653,7 @@ static bool pick_from_internal_rr_locked(
|
|
657
653
|
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].destroy = destroy_client_stats;
|
658
654
|
if (force_async) {
|
659
655
|
GPR_ASSERT(wc_arg->wrapped_closure != NULL);
|
660
|
-
|
656
|
+
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
|
661
657
|
gpr_free(wc_arg->free_when_done);
|
662
658
|
return false;
|
663
659
|
}
|
@@ -670,45 +666,39 @@ static bool pick_from_internal_rr_locked(
|
|
670
666
|
return pick_done;
|
671
667
|
}
|
672
668
|
|
673
|
-
static
|
674
|
-
|
675
|
-
glb_lb_policy *glb_policy) {
|
676
|
-
GPR_ASSERT(serverlist != NULL && serverlist->num_servers > 0);
|
677
|
-
|
678
|
-
grpc_lb_policy_args args;
|
679
|
-
memset(&args, 0, sizeof(args));
|
680
|
-
args.client_channel_factory = glb_policy->cc_factory;
|
681
|
-
args.combiner = glb_policy->base.combiner;
|
669
|
+
static grpc_lb_policy_args *lb_policy_args_create(grpc_exec_ctx *exec_ctx,
|
670
|
+
glb_lb_policy *glb_policy) {
|
682
671
|
grpc_lb_addresses *addresses =
|
683
|
-
process_serverlist_locked(exec_ctx, serverlist);
|
684
|
-
|
672
|
+
process_serverlist_locked(exec_ctx, glb_policy->serverlist);
|
673
|
+
GPR_ASSERT(addresses != NULL);
|
674
|
+
grpc_lb_policy_args *args = gpr_zalloc(sizeof(*args));
|
675
|
+
args->client_channel_factory = glb_policy->cc_factory;
|
676
|
+
args->combiner = glb_policy->base.combiner;
|
685
677
|
// Replace the LB addresses in the channel args that we pass down to
|
686
678
|
// the subchannel.
|
687
679
|
static const char *keys_to_remove[] = {GRPC_ARG_LB_ADDRESSES};
|
688
680
|
const grpc_arg arg = grpc_lb_addresses_create_channel_arg(addresses);
|
689
|
-
args
|
681
|
+
args->args = grpc_channel_args_copy_and_add_and_remove(
|
690
682
|
glb_policy->args, keys_to_remove, GPR_ARRAY_SIZE(keys_to_remove), &arg,
|
691
683
|
1);
|
692
|
-
|
693
|
-
grpc_lb_policy *rr = grpc_lb_policy_create(exec_ctx, "round_robin", &args);
|
694
|
-
GPR_ASSERT(rr != NULL);
|
695
684
|
grpc_lb_addresses_destroy(exec_ctx, addresses);
|
696
|
-
|
697
|
-
|
685
|
+
return args;
|
686
|
+
}
|
687
|
+
|
688
|
+
static void lb_policy_args_destroy(grpc_exec_ctx *exec_ctx,
|
689
|
+
grpc_lb_policy_args *args) {
|
690
|
+
grpc_channel_args_destroy(exec_ctx, args->args);
|
691
|
+
gpr_free(args);
|
698
692
|
}
|
699
693
|
|
700
694
|
static void glb_rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx,
|
701
695
|
void *arg, grpc_error *error);
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
GPR_ASSERT(glb_policy->serverlist != NULL &&
|
706
|
-
glb_policy->serverlist->num_servers > 0);
|
707
|
-
|
708
|
-
if (glb_policy->shutting_down) return;
|
696
|
+
static void create_rr_locked(grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy,
|
697
|
+
grpc_lb_policy_args *args) {
|
698
|
+
GPR_ASSERT(glb_policy->rr_policy == NULL);
|
709
699
|
|
710
700
|
grpc_lb_policy *new_rr_policy =
|
711
|
-
|
701
|
+
grpc_lb_policy_create(exec_ctx, "round_robin", args);
|
712
702
|
if (new_rr_policy == NULL) {
|
713
703
|
gpr_log(GPR_ERROR,
|
714
704
|
"Failure creating a RoundRobin policy for serverlist update with "
|
@@ -719,41 +709,14 @@ static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
|
719
709
|
(void *)glb_policy->rr_policy);
|
720
710
|
return;
|
721
711
|
}
|
722
|
-
|
723
|
-
grpc_error *new_rr_state_error = NULL;
|
724
|
-
const grpc_connectivity_state new_rr_state =
|
725
|
-
grpc_lb_policy_check_connectivity_locked(exec_ctx, new_rr_policy,
|
726
|
-
&new_rr_state_error);
|
727
|
-
/* Connectivity state is a function of the new RR policy just created */
|
728
|
-
const bool replace_old_rr = update_lb_connectivity_status_locked(
|
729
|
-
exec_ctx, glb_policy, new_rr_state, new_rr_state_error);
|
730
|
-
|
731
|
-
if (!replace_old_rr) {
|
732
|
-
/* dispose of the new RR policy that won't be used after all */
|
733
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, new_rr_policy, "rr_handover_no_replace");
|
734
|
-
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
735
|
-
gpr_log(GPR_INFO,
|
736
|
-
"Keeping old RR policy (%p) despite new serverlist: new RR "
|
737
|
-
"policy was in %s connectivity state.",
|
738
|
-
(void *)glb_policy->rr_policy,
|
739
|
-
grpc_connectivity_state_name(new_rr_state));
|
740
|
-
}
|
741
|
-
return;
|
742
|
-
}
|
743
|
-
|
744
|
-
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
745
|
-
gpr_log(GPR_INFO, "Created RR policy (%p) to replace old RR (%p)",
|
746
|
-
(void *)new_rr_policy, (void *)glb_policy->rr_policy);
|
747
|
-
}
|
748
|
-
|
749
|
-
if (glb_policy->rr_policy != NULL) {
|
750
|
-
/* if we are phasing out an existing RR instance, unref it. */
|
751
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "rr_handover");
|
752
|
-
}
|
753
|
-
|
754
|
-
/* Finally update the RR policy to the newly created one */
|
755
712
|
glb_policy->rr_policy = new_rr_policy;
|
756
|
-
|
713
|
+
grpc_error *rr_state_error = NULL;
|
714
|
+
const grpc_connectivity_state rr_state =
|
715
|
+
grpc_lb_policy_check_connectivity_locked(exec_ctx, glb_policy->rr_policy,
|
716
|
+
&rr_state_error);
|
717
|
+
/* Connectivity state is a function of the RR policy updated/created */
|
718
|
+
update_lb_connectivity_status_locked(exec_ctx, glb_policy, rr_state,
|
719
|
+
rr_state_error);
|
757
720
|
/* Add the gRPC LB's interested_parties pollset_set to that of the newly
|
758
721
|
* created RR policy. This will make the RR policy progress upon activity on
|
759
722
|
* gRPC LB, which in turn is tied to the application's call */
|
@@ -765,14 +728,14 @@ static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
|
765
728
|
* It'll be deallocated in glb_rr_connectivity_changed() */
|
766
729
|
rr_connectivity_data *rr_connectivity =
|
767
730
|
gpr_zalloc(sizeof(rr_connectivity_data));
|
768
|
-
|
731
|
+
GRPC_CLOSURE_INIT(&rr_connectivity->on_change,
|
769
732
|
glb_rr_connectivity_changed_locked, rr_connectivity,
|
770
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
733
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
771
734
|
rr_connectivity->glb_policy = glb_policy;
|
772
|
-
rr_connectivity->state =
|
735
|
+
rr_connectivity->state = rr_state;
|
773
736
|
|
774
737
|
/* Subscribe to changes to the connectivity of the new RR */
|
775
|
-
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "
|
738
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "glb_rr_connectivity_cb");
|
776
739
|
grpc_lb_policy_notify_on_state_change_locked(exec_ctx, glb_policy->rr_policy,
|
777
740
|
&rr_connectivity->state,
|
778
741
|
&rr_connectivity->on_change);
|
@@ -787,8 +750,8 @@ static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
|
787
750
|
pp->wrapped_on_complete_arg.client_stats =
|
788
751
|
grpc_grpclb_client_stats_ref(glb_policy->client_stats);
|
789
752
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
790
|
-
gpr_log(GPR_INFO, "Pending pick about to PICK from
|
791
|
-
(
|
753
|
+
gpr_log(GPR_INFO, "Pending pick about to (async) PICK from %p",
|
754
|
+
(void *)glb_policy->rr_policy);
|
792
755
|
}
|
793
756
|
pick_from_internal_rr_locked(exec_ctx, glb_policy, &pp->pick_args,
|
794
757
|
true /* force_async */, pp->target,
|
@@ -809,36 +772,59 @@ static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
|
809
772
|
}
|
810
773
|
}
|
811
774
|
|
775
|
+
/* glb_policy->rr_policy may be NULL (initial handover) */
|
776
|
+
static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
777
|
+
glb_lb_policy *glb_policy) {
|
778
|
+
GPR_ASSERT(glb_policy->serverlist != NULL &&
|
779
|
+
glb_policy->serverlist->num_servers > 0);
|
780
|
+
if (glb_policy->shutting_down) return;
|
781
|
+
grpc_lb_policy_args *args = lb_policy_args_create(exec_ctx, glb_policy);
|
782
|
+
GPR_ASSERT(args != NULL);
|
783
|
+
if (glb_policy->rr_policy != NULL) {
|
784
|
+
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
785
|
+
gpr_log(GPR_DEBUG, "Updating Round Robin policy (%p)",
|
786
|
+
(void *)glb_policy->rr_policy);
|
787
|
+
}
|
788
|
+
grpc_lb_policy_update_locked(exec_ctx, glb_policy->rr_policy, args);
|
789
|
+
} else {
|
790
|
+
create_rr_locked(exec_ctx, glb_policy, args);
|
791
|
+
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
792
|
+
gpr_log(GPR_DEBUG, "Created new Round Robin policy (%p)",
|
793
|
+
(void *)glb_policy->rr_policy);
|
794
|
+
}
|
795
|
+
}
|
796
|
+
lb_policy_args_destroy(exec_ctx, args);
|
797
|
+
}
|
798
|
+
|
812
799
|
static void glb_rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx,
|
813
800
|
void *arg, grpc_error *error) {
|
814
801
|
rr_connectivity_data *rr_connectivity = arg;
|
815
802
|
glb_lb_policy *glb_policy = rr_connectivity->glb_policy;
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
GRPC_ERROR_REF(error);
|
820
|
-
|
821
|
-
if (rr_connectivity->state == GRPC_CHANNEL_SHUTDOWN || shutting_down) {
|
822
|
-
/* RR policy shutting down. Don't renew subscription and free the arg of
|
823
|
-
* this callback. In addition we need to stash away the current policy to
|
824
|
-
* be UNREF'd after releasing the lock. Otherwise, if the UNREF is the last
|
825
|
-
* one, the policy would be destroyed, alongside the lock, which would
|
826
|
-
* result in a use-after-free */
|
827
|
-
unref_needed = true;
|
803
|
+
if (glb_policy->shutting_down) {
|
804
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
805
|
+
"glb_rr_connectivity_cb");
|
828
806
|
gpr_free(rr_connectivity);
|
829
|
-
|
830
|
-
update_lb_connectivity_status_locked(exec_ctx, glb_policy,
|
831
|
-
rr_connectivity->state, error);
|
832
|
-
/* Resubscribe. Reuse the "rr_connectivity_cb" weak ref. */
|
833
|
-
grpc_lb_policy_notify_on_state_change_locked(
|
834
|
-
exec_ctx, glb_policy->rr_policy, &rr_connectivity->state,
|
835
|
-
&rr_connectivity->on_change);
|
807
|
+
return;
|
836
808
|
}
|
837
|
-
if (
|
809
|
+
if (rr_connectivity->state == GRPC_CHANNEL_SHUTDOWN) {
|
810
|
+
/* An RR policy that has transitioned into the SHUTDOWN connectivity state
|
811
|
+
* should not be considered for picks or updates: the SHUTDOWN state is a
|
812
|
+
* sink, policies can't transition back from it. .*/
|
813
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy,
|
814
|
+
"rr_connectivity_shutdown");
|
815
|
+
glb_policy->rr_policy = NULL;
|
838
816
|
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
839
|
-
"
|
817
|
+
"glb_rr_connectivity_cb");
|
818
|
+
gpr_free(rr_connectivity);
|
819
|
+
return;
|
840
820
|
}
|
841
|
-
|
821
|
+
/* rr state != SHUTDOWN && !glb_policy->shutting down: biz as usual */
|
822
|
+
update_lb_connectivity_status_locked(
|
823
|
+
exec_ctx, glb_policy, rr_connectivity->state, GRPC_ERROR_REF(error));
|
824
|
+
/* Resubscribe. Reuse the "glb_rr_connectivity_cb" weak ref. */
|
825
|
+
grpc_lb_policy_notify_on_state_change_locked(exec_ctx, glb_policy->rr_policy,
|
826
|
+
&rr_connectivity->state,
|
827
|
+
&rr_connectivity->on_change);
|
842
828
|
}
|
843
829
|
|
844
830
|
static void destroy_balancer_name(grpc_exec_ctx *exec_ctx,
|
@@ -854,18 +840,24 @@ static grpc_slice_hash_table_entry targets_info_entry_create(
|
|
854
840
|
return entry;
|
855
841
|
}
|
856
842
|
|
857
|
-
|
858
|
-
*
|
859
|
-
*
|
843
|
+
static int balancer_name_cmp_fn(void *a, void *b) {
|
844
|
+
const char *a_str = a;
|
845
|
+
const char *b_str = b;
|
846
|
+
return strcmp(a_str, b_str);
|
847
|
+
}
|
848
|
+
|
849
|
+
/* Returns the channel args for the LB channel, used to create a bidirectional
|
850
|
+
* stream for the reception of load balancing updates.
|
860
851
|
*
|
861
|
-
*
|
862
|
-
*
|
863
|
-
*
|
864
|
-
*
|
865
|
-
*
|
866
|
-
static
|
867
|
-
|
868
|
-
|
852
|
+
* Inputs:
|
853
|
+
* - \a addresses: corresponding to the balancers.
|
854
|
+
* - \a response_generator: in order to propagate updates from the resolver
|
855
|
+
* above the grpclb policy.
|
856
|
+
* - \a args: other args inherited from the grpclb policy. */
|
857
|
+
static grpc_channel_args *build_lb_channel_args(
|
858
|
+
grpc_exec_ctx *exec_ctx, const grpc_lb_addresses *addresses,
|
859
|
+
grpc_fake_resolver_response_generator *response_generator,
|
860
|
+
const grpc_channel_args *args) {
|
869
861
|
size_t num_grpclb_addrs = 0;
|
870
862
|
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
871
863
|
if (addresses->addresses[i].is_balancer) ++num_grpclb_addrs;
|
@@ -874,53 +866,54 @@ static char *get_lb_uri_target_addresses(grpc_exec_ctx *exec_ctx,
|
|
874
866
|
* It's the resolver's responsibility to make sure this policy is only
|
875
867
|
* instantiated and used in that case. Otherwise, something has gone wrong. */
|
876
868
|
GPR_ASSERT(num_grpclb_addrs > 0);
|
877
|
-
|
869
|
+
grpc_lb_addresses *lb_addresses =
|
870
|
+
grpc_lb_addresses_create(num_grpclb_addrs, NULL);
|
878
871
|
grpc_slice_hash_table_entry *targets_info_entries =
|
879
|
-
|
880
|
-
|
881
|
-
/* construct a target ipvX://ip1:port1,ip2:port2,... from the addresses in \a
|
882
|
-
* addresses */
|
883
|
-
/* TODO(dgq): support mixed ip version */
|
884
|
-
char **addr_strs = gpr_malloc(sizeof(char *) * num_grpclb_addrs);
|
885
|
-
size_t addr_index = 0;
|
872
|
+
gpr_zalloc(sizeof(*targets_info_entries) * num_grpclb_addrs);
|
886
873
|
|
887
|
-
|
874
|
+
size_t lb_addresses_idx = 0;
|
875
|
+
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
876
|
+
if (!addresses->addresses[i].is_balancer) continue;
|
888
877
|
if (addresses->addresses[i].user_data != NULL) {
|
889
878
|
gpr_log(GPR_ERROR,
|
890
879
|
"This LB policy doesn't support user data. It will be ignored");
|
891
880
|
}
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
881
|
+
char *addr_str;
|
882
|
+
GPR_ASSERT(grpc_sockaddr_to_string(
|
883
|
+
&addr_str, &addresses->addresses[i].address, true) > 0);
|
884
|
+
targets_info_entries[lb_addresses_idx] = targets_info_entry_create(
|
885
|
+
addr_str, addresses->addresses[i].balancer_name);
|
886
|
+
gpr_free(addr_str);
|
887
|
+
|
888
|
+
grpc_lb_addresses_set_address(
|
889
|
+
lb_addresses, lb_addresses_idx++, addresses->addresses[i].address.addr,
|
890
|
+
addresses->addresses[i].address.len, false /* is balancer */,
|
891
|
+
addresses->addresses[i].balancer_name, NULL /* user data */);
|
900
892
|
}
|
901
|
-
GPR_ASSERT(
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
",", &uri_path_len);
|
906
|
-
for (size_t i = 0; i < num_grpclb_addrs; i++) gpr_free(addr_strs[i]);
|
907
|
-
gpr_free(addr_strs);
|
908
|
-
|
909
|
-
char *target_uri_str = NULL;
|
910
|
-
/* TODO(dgq): Don't assume all addresses will share the scheme of the first
|
911
|
-
* one */
|
912
|
-
gpr_asprintf(&target_uri_str, "%s:%s",
|
913
|
-
grpc_sockaddr_get_uri_scheme(&addresses->addresses[0].address),
|
914
|
-
uri_path);
|
915
|
-
gpr_free(uri_path);
|
916
|
-
|
917
|
-
*targets_info = grpc_slice_hash_table_create(
|
918
|
-
num_grpclb_addrs, targets_info_entries, destroy_balancer_name);
|
893
|
+
GPR_ASSERT(num_grpclb_addrs == lb_addresses_idx);
|
894
|
+
grpc_slice_hash_table *targets_info =
|
895
|
+
grpc_slice_hash_table_create(num_grpclb_addrs, targets_info_entries,
|
896
|
+
destroy_balancer_name, balancer_name_cmp_fn);
|
919
897
|
gpr_free(targets_info_entries);
|
920
898
|
|
921
|
-
|
899
|
+
grpc_channel_args *lb_channel_args =
|
900
|
+
grpc_lb_policy_grpclb_build_lb_channel_args(exec_ctx, targets_info,
|
901
|
+
response_generator, args);
|
902
|
+
|
903
|
+
grpc_arg lb_channel_addresses_arg =
|
904
|
+
grpc_lb_addresses_create_channel_arg(lb_addresses);
|
905
|
+
|
906
|
+
grpc_channel_args *result = grpc_channel_args_copy_and_add(
|
907
|
+
lb_channel_args, &lb_channel_addresses_arg, 1);
|
908
|
+
grpc_slice_hash_table_unref(exec_ctx, targets_info);
|
909
|
+
grpc_channel_args_destroy(exec_ctx, lb_channel_args);
|
910
|
+
grpc_lb_addresses_destroy(exec_ctx, lb_addresses);
|
911
|
+
return result;
|
922
912
|
}
|
923
913
|
|
914
|
+
static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx *exec_ctx,
|
915
|
+
void *arg,
|
916
|
+
grpc_error *error);
|
924
917
|
static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
|
925
918
|
grpc_lb_policy_factory *factory,
|
926
919
|
grpc_lb_policy_args *args) {
|
@@ -968,32 +961,36 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
|
|
968
961
|
|
969
962
|
// Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args,
|
970
963
|
// since we use this to trigger the client_load_reporting filter.
|
971
|
-
grpc_arg new_arg
|
972
|
-
|
973
|
-
new_arg.type = GRPC_ARG_STRING;
|
974
|
-
new_arg.value.string = "grpclb";
|
964
|
+
grpc_arg new_arg =
|
965
|
+
grpc_channel_arg_string_create(GRPC_ARG_LB_POLICY_NAME, "grpclb");
|
975
966
|
static const char *args_to_remove[] = {GRPC_ARG_LB_POLICY_NAME};
|
976
967
|
glb_policy->args = grpc_channel_args_copy_and_add_and_remove(
|
977
968
|
args->args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1);
|
978
969
|
|
979
|
-
grpc_slice_hash_table *targets_info = NULL;
|
980
970
|
/* Create a client channel over them to communicate with a LB service */
|
981
|
-
|
982
|
-
|
983
|
-
grpc_channel_args *lb_channel_args =
|
984
|
-
|
971
|
+
glb_policy->response_generator =
|
972
|
+
grpc_fake_resolver_response_generator_create();
|
973
|
+
grpc_channel_args *lb_channel_args = build_lb_channel_args(
|
974
|
+
exec_ctx, addresses, glb_policy->response_generator, args->args);
|
975
|
+
char *uri_str;
|
976
|
+
gpr_asprintf(&uri_str, "fake:///%s", glb_policy->server_name);
|
985
977
|
glb_policy->lb_channel = grpc_lb_policy_grpclb_create_lb_channel(
|
986
|
-
exec_ctx,
|
987
|
-
|
988
|
-
|
978
|
+
exec_ctx, uri_str, args->client_channel_factory, lb_channel_args);
|
979
|
+
|
980
|
+
/* Propagate initial resolution */
|
981
|
+
grpc_fake_resolver_response_generator_set_response(
|
982
|
+
exec_ctx, glb_policy->response_generator, lb_channel_args);
|
989
983
|
grpc_channel_args_destroy(exec_ctx, lb_channel_args);
|
990
|
-
gpr_free(
|
984
|
+
gpr_free(uri_str);
|
991
985
|
if (glb_policy->lb_channel == NULL) {
|
992
986
|
gpr_free((void *)glb_policy->server_name);
|
993
987
|
grpc_channel_args_destroy(exec_ctx, glb_policy->args);
|
994
988
|
gpr_free(glb_policy);
|
995
989
|
return NULL;
|
996
990
|
}
|
991
|
+
GRPC_CLOSURE_INIT(&glb_policy->lb_channel_on_connectivity_changed,
|
992
|
+
glb_lb_channel_on_connectivity_changed_cb, glb_policy,
|
993
|
+
grpc_combiner_scheduler(args->combiner));
|
997
994
|
grpc_lb_policy_init(&glb_policy->base, &glb_lb_policy_vtable, args->combiner);
|
998
995
|
grpc_connectivity_state_init(&glb_policy->state_tracker, GRPC_CHANNEL_IDLE,
|
999
996
|
"grpclb");
|
@@ -1009,12 +1006,15 @@ static void glb_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
|
1009
1006
|
if (glb_policy->client_stats != NULL) {
|
1010
1007
|
grpc_grpclb_client_stats_unref(glb_policy->client_stats);
|
1011
1008
|
}
|
1012
|
-
grpc_channel_destroy(glb_policy->lb_channel);
|
1013
|
-
glb_policy->lb_channel = NULL;
|
1014
1009
|
grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker);
|
1015
1010
|
if (glb_policy->serverlist != NULL) {
|
1016
1011
|
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
|
1017
1012
|
}
|
1013
|
+
grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
|
1014
|
+
if (glb_policy->pending_update_args != NULL) {
|
1015
|
+
grpc_channel_args_destroy(exec_ctx, glb_policy->pending_update_args->args);
|
1016
|
+
gpr_free(glb_policy->pending_update_args);
|
1017
|
+
}
|
1018
1018
|
gpr_free(glb_policy);
|
1019
1019
|
}
|
1020
1020
|
|
@@ -1022,16 +1022,6 @@ static void glb_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
|
1022
1022
|
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1023
1023
|
glb_policy->shutting_down = true;
|
1024
1024
|
|
1025
|
-
pending_pick *pp = glb_policy->pending_picks;
|
1026
|
-
glb_policy->pending_picks = NULL;
|
1027
|
-
pending_ping *pping = glb_policy->pending_pings;
|
1028
|
-
glb_policy->pending_pings = NULL;
|
1029
|
-
if (glb_policy->rr_policy) {
|
1030
|
-
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "glb_shutdown");
|
1031
|
-
}
|
1032
|
-
grpc_connectivity_state_set(
|
1033
|
-
exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_SHUTDOWN,
|
1034
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"), "glb_shutdown");
|
1035
1025
|
/* We need a copy of the lb_call pointer because we can't cancell the call
|
1036
1026
|
* while holding glb_policy->mu: lb_on_server_status_received, invoked due to
|
1037
1027
|
* the cancel, needs to acquire that same lock */
|
@@ -1045,22 +1035,56 @@ static void glb_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
|
1045
1035
|
grpc_call_cancel(lb_call, NULL);
|
1046
1036
|
/* lb_on_server_status_received will pick up the cancel and clean up */
|
1047
1037
|
}
|
1038
|
+
if (glb_policy->retry_timer_active) {
|
1039
|
+
grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
|
1040
|
+
glb_policy->retry_timer_active = false;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
pending_pick *pp = glb_policy->pending_picks;
|
1044
|
+
glb_policy->pending_picks = NULL;
|
1045
|
+
pending_ping *pping = glb_policy->pending_pings;
|
1046
|
+
glb_policy->pending_pings = NULL;
|
1047
|
+
if (glb_policy->rr_policy != NULL) {
|
1048
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "glb_shutdown");
|
1049
|
+
}
|
1050
|
+
// We destroy the LB channel here because
|
1051
|
+
// glb_lb_channel_on_connectivity_changed_cb needs a valid glb_policy
|
1052
|
+
// instance. Destroying the lb channel in glb_destroy would likely result in
|
1053
|
+
// a callback invocation without a valid glb_policy arg.
|
1054
|
+
if (glb_policy->lb_channel != NULL) {
|
1055
|
+
grpc_channel_destroy(glb_policy->lb_channel);
|
1056
|
+
glb_policy->lb_channel = NULL;
|
1057
|
+
}
|
1058
|
+
grpc_connectivity_state_set(
|
1059
|
+
exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_SHUTDOWN,
|
1060
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"), "glb_shutdown");
|
1061
|
+
|
1048
1062
|
while (pp != NULL) {
|
1049
1063
|
pending_pick *next = pp->next;
|
1050
1064
|
*pp->target = NULL;
|
1051
|
-
|
1065
|
+
GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
1052
1066
|
GRPC_ERROR_NONE);
|
1053
1067
|
pp = next;
|
1054
1068
|
}
|
1055
1069
|
|
1056
1070
|
while (pping != NULL) {
|
1057
1071
|
pending_ping *next = pping->next;
|
1058
|
-
|
1072
|
+
GRPC_CLOSURE_SCHED(exec_ctx, &pping->wrapped_notify_arg.wrapper_closure,
|
1059
1073
|
GRPC_ERROR_NONE);
|
1060
1074
|
pping = next;
|
1061
1075
|
}
|
1062
1076
|
}
|
1063
1077
|
|
1078
|
+
// Cancel a specific pending pick.
|
1079
|
+
//
|
1080
|
+
// A grpclb pick progresses as follows:
|
1081
|
+
// - If there's a Round Robin policy (glb_policy->rr_policy) available, it'll be
|
1082
|
+
// handed over to the RR policy (in create_rr_locked()). From that point
|
1083
|
+
// onwards, it'll be RR's responsibility. For cancellations, that implies the
|
1084
|
+
// pick needs also be cancelled by the RR instance.
|
1085
|
+
// - Otherwise, without an RR instance, picks stay pending at this policy's
|
1086
|
+
// level (grpclb), inside the glb_policy->pending_picks list. To cancel these,
|
1087
|
+
// we invoke the completion closure and set *target to NULL right here.
|
1064
1088
|
static void glb_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
1065
1089
|
grpc_connected_subchannel **target,
|
1066
1090
|
grpc_error *error) {
|
@@ -1071,7 +1095,7 @@ static void glb_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
|
1071
1095
|
pending_pick *next = pp->next;
|
1072
1096
|
if (pp->target == target) {
|
1073
1097
|
*target = NULL;
|
1074
|
-
|
1098
|
+
GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
1075
1099
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1076
1100
|
"Pick Cancelled", &error, 1));
|
1077
1101
|
} else {
|
@@ -1080,9 +1104,23 @@ static void glb_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
|
1080
1104
|
}
|
1081
1105
|
pp = next;
|
1082
1106
|
}
|
1107
|
+
if (glb_policy->rr_policy != NULL) {
|
1108
|
+
grpc_lb_policy_cancel_pick_locked(exec_ctx, glb_policy->rr_policy, target,
|
1109
|
+
GRPC_ERROR_REF(error));
|
1110
|
+
}
|
1083
1111
|
GRPC_ERROR_UNREF(error);
|
1084
1112
|
}
|
1085
1113
|
|
1114
|
+
// Cancel all pending picks.
|
1115
|
+
//
|
1116
|
+
// A grpclb pick progresses as follows:
|
1117
|
+
// - If there's a Round Robin policy (glb_policy->rr_policy) available, it'll be
|
1118
|
+
// handed over to the RR policy (in create_rr_locked()). From that point
|
1119
|
+
// onwards, it'll be RR's responsibility. For cancellations, that implies the
|
1120
|
+
// pick needs also be cancelled by the RR instance.
|
1121
|
+
// - Otherwise, without an RR instance, picks stay pending at this policy's
|
1122
|
+
// level (grpclb), inside the glb_policy->pending_picks list. To cancel these,
|
1123
|
+
// we invoke the completion closure and set *target to NULL right here.
|
1086
1124
|
static void glb_cancel_picks_locked(grpc_exec_ctx *exec_ctx,
|
1087
1125
|
grpc_lb_policy *pol,
|
1088
1126
|
uint32_t initial_metadata_flags_mask,
|
@@ -1095,7 +1133,7 @@ static void glb_cancel_picks_locked(grpc_exec_ctx *exec_ctx,
|
|
1095
1133
|
pending_pick *next = pp->next;
|
1096
1134
|
if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) ==
|
1097
1135
|
initial_metadata_flags_eq) {
|
1098
|
-
|
1136
|
+
GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
1099
1137
|
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
1100
1138
|
"Pick Cancelled", &error, 1));
|
1101
1139
|
} else {
|
@@ -1104,6 +1142,11 @@ static void glb_cancel_picks_locked(grpc_exec_ctx *exec_ctx,
|
|
1104
1142
|
}
|
1105
1143
|
pp = next;
|
1106
1144
|
}
|
1145
|
+
if (glb_policy->rr_policy != NULL) {
|
1146
|
+
grpc_lb_policy_cancel_picks_locked(
|
1147
|
+
exec_ctx, glb_policy->rr_policy, initial_metadata_flags_mask,
|
1148
|
+
initial_metadata_flags_eq, GRPC_ERROR_REF(error));
|
1149
|
+
}
|
1107
1150
|
GRPC_ERROR_UNREF(error);
|
1108
1151
|
}
|
1109
1152
|
|
@@ -1130,7 +1173,7 @@ static int glb_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
|
1130
1173
|
grpc_closure *on_complete) {
|
1131
1174
|
if (pick_args->lb_token_mdelem_storage == NULL) {
|
1132
1175
|
*target = NULL;
|
1133
|
-
|
1176
|
+
GRPC_CLOSURE_SCHED(exec_ctx, on_complete,
|
1134
1177
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1135
1178
|
"No mdelem storage for the LB token. Load reporting "
|
1136
1179
|
"won't work without it. Failing"));
|
@@ -1149,7 +1192,7 @@ static int glb_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
|
1149
1192
|
|
1150
1193
|
wrapped_rr_closure_arg *wc_arg = gpr_zalloc(sizeof(wrapped_rr_closure_arg));
|
1151
1194
|
|
1152
|
-
|
1195
|
+
GRPC_CLOSURE_INIT(&wc_arg->wrapper_closure, wrapped_rr_closure, wc_arg,
|
1153
1196
|
grpc_schedule_on_exec_ctx);
|
1154
1197
|
wc_arg->rr_policy = glb_policy->rr_policy;
|
1155
1198
|
wc_arg->target = target;
|
@@ -1220,9 +1263,9 @@ static void schedule_next_client_load_report(grpc_exec_ctx *exec_ctx,
|
|
1220
1263
|
const gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
1221
1264
|
const gpr_timespec next_client_load_report_time =
|
1222
1265
|
gpr_time_add(now, glb_policy->client_stats_report_interval);
|
1223
|
-
|
1266
|
+
GRPC_CLOSURE_INIT(&glb_policy->client_load_report_closure,
|
1224
1267
|
send_client_load_report_locked, glb_policy,
|
1225
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
1268
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1226
1269
|
grpc_timer_init(exec_ctx, &glb_policy->client_load_report_timer,
|
1227
1270
|
next_client_load_report_time,
|
1228
1271
|
&glb_policy->client_load_report_closure, now);
|
@@ -1248,9 +1291,9 @@ static void do_send_client_load_report_locked(grpc_exec_ctx *exec_ctx,
|
|
1248
1291
|
memset(&op, 0, sizeof(op));
|
1249
1292
|
op.op = GRPC_OP_SEND_MESSAGE;
|
1250
1293
|
op.data.send_message.send_message = glb_policy->client_load_report_payload;
|
1251
|
-
|
1294
|
+
GRPC_CLOSURE_INIT(&glb_policy->client_load_report_closure,
|
1252
1295
|
client_load_report_done_locked, glb_policy,
|
1253
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
1296
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1254
1297
|
grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1255
1298
|
exec_ctx, glb_policy->lb_call, &op, 1,
|
1256
1299
|
&glb_policy->client_load_report_closure);
|
@@ -1258,15 +1301,14 @@ static void do_send_client_load_report_locked(grpc_exec_ctx *exec_ctx,
|
|
1258
1301
|
}
|
1259
1302
|
|
1260
1303
|
static bool load_report_counters_are_zero(grpc_grpclb_request *request) {
|
1304
|
+
grpc_grpclb_dropped_call_counts *drop_entries =
|
1305
|
+
request->client_stats.calls_finished_with_drop.arg;
|
1261
1306
|
return request->client_stats.num_calls_started == 0 &&
|
1262
1307
|
request->client_stats.num_calls_finished == 0 &&
|
1263
|
-
request->client_stats.num_calls_finished_with_drop_for_rate_limiting ==
|
1264
|
-
0 &&
|
1265
|
-
request->client_stats
|
1266
|
-
.num_calls_finished_with_drop_for_load_balancing == 0 &&
|
1267
1308
|
request->client_stats.num_calls_finished_with_client_failed_to_send ==
|
1268
1309
|
0 &&
|
1269
|
-
request->client_stats.num_calls_finished_known_received == 0
|
1310
|
+
request->client_stats.num_calls_finished_known_received == 0 &&
|
1311
|
+
(drop_entries == NULL || drop_entries->num_entries == 0);
|
1270
1312
|
}
|
1271
1313
|
|
1272
1314
|
static void send_client_load_report_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
@@ -1281,7 +1323,7 @@ static void send_client_load_report_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1281
1323
|
// Construct message payload.
|
1282
1324
|
GPR_ASSERT(glb_policy->client_load_report_payload == NULL);
|
1283
1325
|
grpc_grpclb_request *request =
|
1284
|
-
|
1326
|
+
grpc_grpclb_load_report_request_create_locked(glb_policy->client_stats);
|
1285
1327
|
// Skip client load report if the counters were all zero in the last
|
1286
1328
|
// report and they are still zero in this one.
|
1287
1329
|
if (load_report_counters_are_zero(request)) {
|
@@ -1318,6 +1360,7 @@ static void lb_call_init_locked(grpc_exec_ctx *exec_ctx,
|
|
1318
1360
|
glb_lb_policy *glb_policy) {
|
1319
1361
|
GPR_ASSERT(glb_policy->server_name != NULL);
|
1320
1362
|
GPR_ASSERT(glb_policy->server_name[0] != '\0');
|
1363
|
+
GPR_ASSERT(glb_policy->lb_call == NULL);
|
1321
1364
|
GPR_ASSERT(!glb_policy->shutting_down);
|
1322
1365
|
|
1323
1366
|
/* Note the following LB call progresses every time there's activity in \a
|
@@ -1353,15 +1396,15 @@ static void lb_call_init_locked(grpc_exec_ctx *exec_ctx,
|
|
1353
1396
|
grpc_slice_unref_internal(exec_ctx, request_payload_slice);
|
1354
1397
|
grpc_grpclb_request_destroy(request);
|
1355
1398
|
|
1356
|
-
|
1399
|
+
GRPC_CLOSURE_INIT(&glb_policy->lb_on_sent_initial_request,
|
1357
1400
|
lb_on_sent_initial_request_locked, glb_policy,
|
1358
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
1359
|
-
|
1401
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1402
|
+
GRPC_CLOSURE_INIT(&glb_policy->lb_on_server_status_received,
|
1360
1403
|
lb_on_server_status_received_locked, glb_policy,
|
1361
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
1362
|
-
|
1404
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1405
|
+
GRPC_CLOSURE_INIT(&glb_policy->lb_on_response_received,
|
1363
1406
|
lb_on_response_received_locked, glb_policy,
|
1364
|
-
grpc_combiner_scheduler(glb_policy->base.combiner
|
1407
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1365
1408
|
|
1366
1409
|
gpr_backoff_init(&glb_policy->lb_call_backoff_state,
|
1367
1410
|
GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS,
|
@@ -1403,8 +1446,10 @@ static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
|
1403
1446
|
lb_call_init_locked(exec_ctx, glb_policy);
|
1404
1447
|
|
1405
1448
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
1406
|
-
gpr_log(GPR_INFO,
|
1407
|
-
(
|
1449
|
+
gpr_log(GPR_INFO,
|
1450
|
+
"Query for backends (grpclb: %p, lb_channel: %p, lb_call: %p)",
|
1451
|
+
(void *)glb_policy, (void *)glb_policy->lb_channel,
|
1452
|
+
(void *)glb_policy->lb_call);
|
1408
1453
|
}
|
1409
1454
|
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1410
1455
|
|
@@ -1432,7 +1477,8 @@ static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
|
1432
1477
|
op++;
|
1433
1478
|
/* take a weak ref (won't prevent calling of \a glb_shutdown if the strong ref
|
1434
1479
|
* count goes to zero) to be unref'd in lb_on_sent_initial_request_locked() */
|
1435
|
-
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base,
|
1480
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base,
|
1481
|
+
"lb_on_sent_initial_request_locked");
|
1436
1482
|
call_error = grpc_call_start_batch_and_execute(
|
1437
1483
|
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1438
1484
|
&glb_policy->lb_on_sent_initial_request);
|
@@ -1449,8 +1495,9 @@ static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
|
1449
1495
|
op->reserved = NULL;
|
1450
1496
|
op++;
|
1451
1497
|
/* take a weak ref (won't prevent calling of \a glb_shutdown if the strong ref
|
1452
|
-
* count goes to zero) to be unref'd in
|
1453
|
-
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base,
|
1498
|
+
* count goes to zero) to be unref'd in lb_on_server_status_received_locked */
|
1499
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base,
|
1500
|
+
"lb_on_server_status_received_locked");
|
1454
1501
|
call_error = grpc_call_start_batch_and_execute(
|
1455
1502
|
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1456
1503
|
&glb_policy->lb_on_server_status_received);
|
@@ -1462,8 +1509,9 @@ static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
|
1462
1509
|
op->flags = 0;
|
1463
1510
|
op->reserved = NULL;
|
1464
1511
|
op++;
|
1465
|
-
/* take another weak ref to be unref'd in
|
1466
|
-
|
1512
|
+
/* take another weak ref to be unref'd/reused in
|
1513
|
+
* lb_on_response_received_locked */
|
1514
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "lb_on_response_received_locked");
|
1467
1515
|
call_error = grpc_call_start_batch_and_execute(
|
1468
1516
|
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1469
1517
|
&glb_policy->lb_on_response_received);
|
@@ -1480,13 +1528,12 @@ static void lb_on_sent_initial_request_locked(grpc_exec_ctx *exec_ctx,
|
|
1480
1528
|
do_send_client_load_report_locked(exec_ctx, glb_policy);
|
1481
1529
|
}
|
1482
1530
|
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1483
|
-
"
|
1531
|
+
"lb_on_sent_initial_request_locked");
|
1484
1532
|
}
|
1485
1533
|
|
1486
1534
|
static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1487
1535
|
grpc_error *error) {
|
1488
1536
|
glb_lb_policy *glb_policy = arg;
|
1489
|
-
|
1490
1537
|
grpc_op ops[2];
|
1491
1538
|
memset(ops, 0, sizeof(ops));
|
1492
1539
|
grpc_op *op = ops;
|
@@ -1517,7 +1564,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1517
1564
|
}
|
1518
1565
|
/* take a weak ref (won't prevent calling of \a glb_shutdown() if the
|
1519
1566
|
* strong ref count goes to zero) to be unref'd in
|
1520
|
-
*
|
1567
|
+
* send_client_load_report_locked() */
|
1521
1568
|
glb_policy->client_load_report_timer_pending = true;
|
1522
1569
|
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "client_load_report");
|
1523
1570
|
schedule_next_client_load_report(exec_ctx, glb_policy);
|
@@ -1545,7 +1592,6 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1545
1592
|
gpr_free(ipport);
|
1546
1593
|
}
|
1547
1594
|
}
|
1548
|
-
|
1549
1595
|
/* update serverlist */
|
1550
1596
|
if (serverlist->num_servers > 0) {
|
1551
1597
|
if (grpc_grpclb_serverlist_equals(glb_policy->serverlist,
|
@@ -1580,9 +1626,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1580
1626
|
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
|
1581
1627
|
}
|
1582
1628
|
}
|
1583
|
-
|
1584
1629
|
grpc_slice_unref_internal(exec_ctx, response_slice);
|
1585
|
-
|
1586
1630
|
if (!glb_policy->shutting_down) {
|
1587
1631
|
/* keep listening for serverlist updates */
|
1588
1632
|
op->op = GRPC_OP_RECV_MESSAGE;
|
@@ -1590,7 +1634,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1590
1634
|
op->flags = 0;
|
1591
1635
|
op->reserved = NULL;
|
1592
1636
|
op++;
|
1593
|
-
/* reuse the "
|
1637
|
+
/* reuse the "lb_on_response_received_locked" weak ref taken in
|
1594
1638
|
* query_for_backends_locked() */
|
1595
1639
|
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1596
1640
|
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
@@ -1598,18 +1642,18 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1598
1642
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1599
1643
|
}
|
1600
1644
|
} else { /* empty payload: call cancelled. */
|
1601
|
-
/* dispose of the "
|
1645
|
+
/* dispose of the "lb_on_response_received_locked" weak ref taken in
|
1602
1646
|
* query_for_backends_locked() and reused in every reception loop */
|
1603
1647
|
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1604
|
-
"
|
1648
|
+
"lb_on_response_received_locked_empty_payload");
|
1605
1649
|
}
|
1606
1650
|
}
|
1607
1651
|
|
1608
1652
|
static void lb_call_on_retry_timer_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1609
1653
|
grpc_error *error) {
|
1610
1654
|
glb_lb_policy *glb_policy = arg;
|
1611
|
-
|
1612
|
-
if (!glb_policy->shutting_down) {
|
1655
|
+
glb_policy->retry_timer_active = false;
|
1656
|
+
if (!glb_policy->shutting_down && error == GRPC_ERROR_NONE) {
|
1613
1657
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
1614
1658
|
gpr_log(GPR_INFO, "Restaring call to LB server (grpclb %p)",
|
1615
1659
|
(void *)glb_policy);
|
@@ -1617,31 +1661,32 @@ static void lb_call_on_retry_timer_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
|
1617
1661
|
GPR_ASSERT(glb_policy->lb_call == NULL);
|
1618
1662
|
query_for_backends_locked(exec_ctx, glb_policy);
|
1619
1663
|
}
|
1620
|
-
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1621
|
-
"grpclb_on_retry_timer");
|
1664
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base, "grpclb_retry_timer");
|
1622
1665
|
}
|
1623
1666
|
|
1624
1667
|
static void lb_on_server_status_received_locked(grpc_exec_ctx *exec_ctx,
|
1625
1668
|
void *arg, grpc_error *error) {
|
1626
1669
|
glb_lb_policy *glb_policy = arg;
|
1627
|
-
|
1628
1670
|
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1629
|
-
|
1630
1671
|
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
1631
1672
|
char *status_details =
|
1632
1673
|
grpc_slice_to_c_string(glb_policy->lb_call_status_details);
|
1633
|
-
gpr_log(
|
1674
|
+
gpr_log(GPR_INFO,
|
1634
1675
|
"Status from LB server received. Status = %d, Details = '%s', "
|
1635
|
-
"(call: %p)",
|
1676
|
+
"(call: %p), error %p",
|
1636
1677
|
glb_policy->lb_call_status, status_details,
|
1637
|
-
(void *)glb_policy->lb_call);
|
1678
|
+
(void *)glb_policy->lb_call, (void *)error);
|
1638
1679
|
gpr_free(status_details);
|
1639
1680
|
}
|
1640
|
-
|
1641
1681
|
/* We need to perform cleanups no matter what. */
|
1642
1682
|
lb_call_destroy_locked(exec_ctx, glb_policy);
|
1643
|
-
|
1644
|
-
|
1683
|
+
if (glb_policy->started_picking && glb_policy->updating_lb_call) {
|
1684
|
+
if (glb_policy->retry_timer_active) {
|
1685
|
+
grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
|
1686
|
+
}
|
1687
|
+
if (!glb_policy->shutting_down) start_picking_locked(exec_ctx, glb_policy);
|
1688
|
+
glb_policy->updating_lb_call = false;
|
1689
|
+
} else if (!glb_policy->shutting_down) {
|
1645
1690
|
/* if we aren't shutting down, restart the LB client call after some time */
|
1646
1691
|
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
1647
1692
|
gpr_timespec next_try =
|
@@ -1651,21 +1696,157 @@ static void lb_on_server_status_received_locked(grpc_exec_ctx *exec_ctx,
|
|
1651
1696
|
(void *)glb_policy);
|
1652
1697
|
gpr_timespec timeout = gpr_time_sub(next_try, now);
|
1653
1698
|
if (gpr_time_cmp(timeout, gpr_time_0(timeout.clock_type)) > 0) {
|
1654
|
-
gpr_log(GPR_DEBUG,
|
1699
|
+
gpr_log(GPR_DEBUG,
|
1700
|
+
"... retry_timer_active in %" PRId64 ".%09d seconds.",
|
1655
1701
|
timeout.tv_sec, timeout.tv_nsec);
|
1656
1702
|
} else {
|
1657
|
-
gpr_log(GPR_DEBUG, "...
|
1703
|
+
gpr_log(GPR_DEBUG, "... retry_timer_active immediately.");
|
1658
1704
|
}
|
1659
1705
|
}
|
1660
1706
|
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_retry_timer");
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1707
|
+
GRPC_CLOSURE_INIT(&glb_policy->lb_on_call_retry,
|
1708
|
+
lb_call_on_retry_timer_locked, glb_policy,
|
1709
|
+
grpc_combiner_scheduler(glb_policy->base.combiner));
|
1710
|
+
glb_policy->retry_timer_active = true;
|
1664
1711
|
grpc_timer_init(exec_ctx, &glb_policy->lb_call_retry_timer, next_try,
|
1665
1712
|
&glb_policy->lb_on_call_retry, now);
|
1666
1713
|
}
|
1667
1714
|
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1668
|
-
"
|
1715
|
+
"lb_on_server_status_received_locked");
|
1716
|
+
}
|
1717
|
+
|
1718
|
+
static void glb_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
1719
|
+
const grpc_lb_policy_args *args) {
|
1720
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)policy;
|
1721
|
+
if (glb_policy->updating_lb_channel) {
|
1722
|
+
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
|
1723
|
+
gpr_log(GPR_INFO,
|
1724
|
+
"Update already in progress for grpclb %p. Deferring update.",
|
1725
|
+
(void *)glb_policy);
|
1726
|
+
}
|
1727
|
+
if (glb_policy->pending_update_args != NULL) {
|
1728
|
+
grpc_channel_args_destroy(exec_ctx,
|
1729
|
+
glb_policy->pending_update_args->args);
|
1730
|
+
gpr_free(glb_policy->pending_update_args);
|
1731
|
+
}
|
1732
|
+
glb_policy->pending_update_args =
|
1733
|
+
gpr_zalloc(sizeof(*glb_policy->pending_update_args));
|
1734
|
+
glb_policy->pending_update_args->client_channel_factory =
|
1735
|
+
args->client_channel_factory;
|
1736
|
+
glb_policy->pending_update_args->args = grpc_channel_args_copy(args->args);
|
1737
|
+
glb_policy->pending_update_args->combiner = args->combiner;
|
1738
|
+
return;
|
1739
|
+
}
|
1740
|
+
|
1741
|
+
glb_policy->updating_lb_channel = true;
|
1742
|
+
// Propagate update to lb_channel (pick first).
|
1743
|
+
const grpc_arg *arg =
|
1744
|
+
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
|
1745
|
+
if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
|
1746
|
+
if (glb_policy->lb_channel == NULL) {
|
1747
|
+
// If we don't have a current channel to the LB, go into TRANSIENT
|
1748
|
+
// FAILURE.
|
1749
|
+
grpc_connectivity_state_set(
|
1750
|
+
exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
1751
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
|
1752
|
+
"glb_update_missing");
|
1753
|
+
} else {
|
1754
|
+
// otherwise, keep using the current LB channel (ignore this update).
|
1755
|
+
gpr_log(GPR_ERROR,
|
1756
|
+
"No valid LB addresses channel arg for grpclb %p update, "
|
1757
|
+
"ignoring.",
|
1758
|
+
(void *)glb_policy);
|
1759
|
+
}
|
1760
|
+
}
|
1761
|
+
const grpc_lb_addresses *addresses = arg->value.pointer.p;
|
1762
|
+
GPR_ASSERT(glb_policy->lb_channel != NULL);
|
1763
|
+
grpc_channel_args *lb_channel_args = build_lb_channel_args(
|
1764
|
+
exec_ctx, addresses, glb_policy->response_generator, args->args);
|
1765
|
+
/* Propagate updates to the LB channel through the fake resolver */
|
1766
|
+
grpc_fake_resolver_response_generator_set_response(
|
1767
|
+
exec_ctx, glb_policy->response_generator, lb_channel_args);
|
1768
|
+
grpc_channel_args_destroy(exec_ctx, lb_channel_args);
|
1769
|
+
|
1770
|
+
if (!glb_policy->watching_lb_channel) {
|
1771
|
+
// Watch the LB channel connectivity for connection.
|
1772
|
+
glb_policy->lb_channel_connectivity = grpc_channel_check_connectivity_state(
|
1773
|
+
glb_policy->lb_channel, true /* try to connect */);
|
1774
|
+
grpc_channel_element *client_channel_elem = grpc_channel_stack_last_element(
|
1775
|
+
grpc_channel_get_channel_stack(glb_policy->lb_channel));
|
1776
|
+
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
|
1777
|
+
glb_policy->watching_lb_channel = true;
|
1778
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "watch_lb_channel_connectivity");
|
1779
|
+
grpc_client_channel_watch_connectivity_state(
|
1780
|
+
exec_ctx, client_channel_elem,
|
1781
|
+
grpc_polling_entity_create_from_pollset_set(
|
1782
|
+
glb_policy->base.interested_parties),
|
1783
|
+
&glb_policy->lb_channel_connectivity,
|
1784
|
+
&glb_policy->lb_channel_on_connectivity_changed, NULL);
|
1785
|
+
}
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
// Invoked as part of the update process. It continues watching the LB channel
|
1789
|
+
// until it shuts down or becomes READY. It's invoked even if the LB channel
|
1790
|
+
// stayed READY throughout the update (for example if the update is identical).
|
1791
|
+
static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx *exec_ctx,
|
1792
|
+
void *arg,
|
1793
|
+
grpc_error *error) {
|
1794
|
+
glb_lb_policy *glb_policy = arg;
|
1795
|
+
if (glb_policy->shutting_down) goto done;
|
1796
|
+
// Re-initialize the lb_call. This should also take care of updating the
|
1797
|
+
// embedded RR policy. Note that the current RR policy, if any, will stay in
|
1798
|
+
// effect until an update from the new lb_call is received.
|
1799
|
+
switch (glb_policy->lb_channel_connectivity) {
|
1800
|
+
case GRPC_CHANNEL_INIT:
|
1801
|
+
case GRPC_CHANNEL_CONNECTING:
|
1802
|
+
case GRPC_CHANNEL_TRANSIENT_FAILURE: {
|
1803
|
+
/* resub. */
|
1804
|
+
grpc_channel_element *client_channel_elem =
|
1805
|
+
grpc_channel_stack_last_element(
|
1806
|
+
grpc_channel_get_channel_stack(glb_policy->lb_channel));
|
1807
|
+
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
|
1808
|
+
grpc_client_channel_watch_connectivity_state(
|
1809
|
+
exec_ctx, client_channel_elem,
|
1810
|
+
grpc_polling_entity_create_from_pollset_set(
|
1811
|
+
glb_policy->base.interested_parties),
|
1812
|
+
&glb_policy->lb_channel_connectivity,
|
1813
|
+
&glb_policy->lb_channel_on_connectivity_changed, NULL);
|
1814
|
+
break;
|
1815
|
+
}
|
1816
|
+
case GRPC_CHANNEL_IDLE:
|
1817
|
+
// lb channel inactive (probably shutdown prior to update). Restart lb
|
1818
|
+
// call to kick the lb channel into gear.
|
1819
|
+
GPR_ASSERT(glb_policy->lb_call == NULL);
|
1820
|
+
/* fallthrough */
|
1821
|
+
case GRPC_CHANNEL_READY:
|
1822
|
+
if (glb_policy->lb_call != NULL) {
|
1823
|
+
glb_policy->updating_lb_channel = false;
|
1824
|
+
glb_policy->updating_lb_call = true;
|
1825
|
+
grpc_call_cancel(glb_policy->lb_call, NULL);
|
1826
|
+
// lb_on_server_status_received will pick up the cancel and reinit
|
1827
|
+
// lb_call.
|
1828
|
+
if (glb_policy->pending_update_args != NULL) {
|
1829
|
+
grpc_lb_policy_args *args = glb_policy->pending_update_args;
|
1830
|
+
glb_policy->pending_update_args = NULL;
|
1831
|
+
glb_update_locked(exec_ctx, &glb_policy->base, args);
|
1832
|
+
grpc_channel_args_destroy(exec_ctx, args->args);
|
1833
|
+
gpr_free(args);
|
1834
|
+
}
|
1835
|
+
} else if (glb_policy->started_picking && !glb_policy->shutting_down) {
|
1836
|
+
if (glb_policy->retry_timer_active) {
|
1837
|
+
grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
|
1838
|
+
glb_policy->retry_timer_active = false;
|
1839
|
+
}
|
1840
|
+
start_picking_locked(exec_ctx, glb_policy);
|
1841
|
+
}
|
1842
|
+
/* fallthrough */
|
1843
|
+
case GRPC_CHANNEL_SHUTDOWN:
|
1844
|
+
done:
|
1845
|
+
glb_policy->watching_lb_channel = false;
|
1846
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1847
|
+
"watch_lb_channel_connectivity_cb_shutdown");
|
1848
|
+
break;
|
1849
|
+
}
|
1669
1850
|
}
|
1670
1851
|
|
1671
1852
|
/* Code wiring the policy with the rest of the core */
|
@@ -1678,7 +1859,8 @@ static const grpc_lb_policy_vtable glb_lb_policy_vtable = {
|
|
1678
1859
|
glb_ping_one_locked,
|
1679
1860
|
glb_exit_idle_locked,
|
1680
1861
|
glb_check_connectivity_locked,
|
1681
|
-
glb_notify_on_state_change_locked
|
1862
|
+
glb_notify_on_state_change_locked,
|
1863
|
+
glb_update_locked};
|
1682
1864
|
|
1683
1865
|
static void glb_factory_ref(grpc_lb_policy_factory *factory) {}
|
1684
1866
|
|
@@ -1712,7 +1894,10 @@ static bool maybe_add_client_load_reporting_filter(
|
|
1712
1894
|
|
1713
1895
|
void grpc_lb_policy_grpclb_init() {
|
1714
1896
|
grpc_register_lb_policy(grpc_glb_lb_factory_create());
|
1715
|
-
grpc_register_tracer(
|
1897
|
+
grpc_register_tracer(&grpc_lb_glb_trace);
|
1898
|
+
#ifndef NDEBUG
|
1899
|
+
grpc_register_tracer(&grpc_trace_lb_policy_refcount);
|
1900
|
+
#endif
|
1716
1901
|
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL,
|
1717
1902
|
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
|
1718
1903
|
maybe_add_client_load_reporting_filter,
|