wearefair-grpc 1.3.1.pre.a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +1 -0
- data/Makefile +19484 -0
- data/etc/roots.pem +5288 -0
- data/include/grpc/byte_buffer.h +102 -0
- data/include/grpc/byte_buffer_reader.h +39 -0
- data/include/grpc/census.h +484 -0
- data/include/grpc/compression.h +85 -0
- data/include/grpc/grpc.h +509 -0
- data/include/grpc/grpc_cronet.h +51 -0
- data/include/grpc/grpc_posix.h +81 -0
- data/include/grpc/grpc_security.h +390 -0
- data/include/grpc/grpc_security_constants.h +114 -0
- data/include/grpc/impl/codegen/atm.h +100 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +97 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +97 -0
- data/include/grpc/impl/codegen/atm_windows.h +140 -0
- data/include/grpc/impl/codegen/byte_buffer_reader.h +57 -0
- data/include/grpc/impl/codegen/compression_types.h +122 -0
- data/include/grpc/impl/codegen/connectivity_state.h +61 -0
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +41 -0
- data/include/grpc/impl/codegen/gpr_slice.h +84 -0
- data/include/grpc/impl/codegen/gpr_types.h +75 -0
- data/include/grpc/impl/codegen/grpc_types.h +550 -0
- data/include/grpc/impl/codegen/port_platform.h +421 -0
- data/include/grpc/impl/codegen/propagation_bits.h +67 -0
- data/include/grpc/impl/codegen/slice.h +157 -0
- data/include/grpc/impl/codegen/status.h +163 -0
- data/include/grpc/impl/codegen/sync.h +75 -0
- data/include/grpc/impl/codegen/sync_generic.h +55 -0
- data/include/grpc/impl/codegen/sync_posix.h +47 -0
- data/include/grpc/impl/codegen/sync_windows.h +49 -0
- data/include/grpc/load_reporting.h +63 -0
- data/include/grpc/module.modulemap +13 -0
- data/include/grpc/slice.h +168 -0
- data/include/grpc/slice_buffer.h +94 -0
- data/include/grpc/status.h +39 -0
- data/include/grpc/support/alloc.h +82 -0
- data/include/grpc/support/atm.h +39 -0
- data/include/grpc/support/atm_gcc_atomic.h +39 -0
- data/include/grpc/support/atm_gcc_sync.h +39 -0
- data/include/grpc/support/atm_windows.h +39 -0
- data/include/grpc/support/avl.h +97 -0
- data/include/grpc/support/cmdline.h +103 -0
- data/include/grpc/support/cpu.h +59 -0
- data/include/grpc/support/histogram.h +79 -0
- data/include/grpc/support/host_port.h +66 -0
- data/include/grpc/support/log.h +118 -0
- data/include/grpc/support/log_windows.h +53 -0
- data/include/grpc/support/port_platform.h +39 -0
- data/include/grpc/support/string_util.h +64 -0
- data/include/grpc/support/subprocess.h +59 -0
- data/include/grpc/support/sync.h +295 -0
- data/include/grpc/support/sync_generic.h +39 -0
- data/include/grpc/support/sync_posix.h +39 -0
- data/include/grpc/support/sync_windows.h +39 -0
- data/include/grpc/support/thd.h +91 -0
- data/include/grpc/support/time.h +105 -0
- data/include/grpc/support/tls.h +77 -0
- data/include/grpc/support/tls_gcc.h +100 -0
- data/include/grpc/support/tls_msvc.h +56 -0
- data/include/grpc/support/tls_pthread.h +60 -0
- data/include/grpc/support/useful.h +80 -0
- data/src/boringssl/err_data.c +1270 -0
- data/src/core/ext/census/aggregation.h +66 -0
- data/src/core/ext/census/base_resources.c +71 -0
- data/src/core/ext/census/base_resources.h +39 -0
- data/src/core/ext/census/census_interface.h +76 -0
- data/src/core/ext/census/census_rpc_stats.h +101 -0
- data/src/core/ext/census/context.c +509 -0
- data/src/core/ext/census/gen/census.pb.c +176 -0
- data/src/core/ext/census/gen/census.pb.h +295 -0
- data/src/core/ext/census/gen/trace_context.pb.c +54 -0
- data/src/core/ext/census/gen/trace_context.pb.h +93 -0
- data/src/core/ext/census/grpc_context.c +53 -0
- data/src/core/ext/census/grpc_filter.c +213 -0
- data/src/core/ext/census/grpc_filter.h +44 -0
- data/src/core/ext/census/grpc_plugin.c +85 -0
- data/src/core/ext/census/initialize.c +66 -0
- data/src/core/ext/census/mlog.c +600 -0
- data/src/core/ext/census/mlog.h +95 -0
- data/src/core/ext/census/operation.c +63 -0
- data/src/core/ext/census/placeholders.c +64 -0
- data/src/core/ext/census/resource.c +312 -0
- data/src/core/ext/census/resource.h +63 -0
- data/src/core/ext/census/rpc_metric_id.h +51 -0
- data/src/core/ext/census/trace_context.c +86 -0
- data/src/core/ext/census/trace_context.h +71 -0
- data/src/core/ext/census/trace_label.h +61 -0
- data/src/core/ext/census/trace_propagation.h +63 -0
- data/src/core/ext/census/trace_status.h +45 -0
- data/src/core/ext/census/trace_string.h +50 -0
- data/src/core/ext/census/tracing.c +71 -0
- data/src/core/ext/census/tracing.h +124 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.c +226 -0
- data/src/core/ext/filters/client_channel/client_channel.c +1410 -0
- data/src/core/ext/filters/client_channel/client_channel.h +64 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.c +87 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +92 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +106 -0
- data/src/core/ext/filters/client_channel/connector.c +55 -0
- data/src/core/ext/filters/client_channel/connector.h +88 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.c +389 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +49 -0
- data/src/core/ext/filters/client_channel/http_proxy.c +125 -0
- data/src/core/ext/filters/client_channel/http_proxy.h +39 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +1419 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +44 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +57 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +107 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +249 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +105 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +88 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +158 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +476 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +795 -0
- data/src/core/ext/filters/client_channel/lb_policy.c +167 -0
- data/src/core/ext/filters/client_channel/lb_policy.h +209 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +163 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +134 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.c +85 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +55 -0
- data/src/core/ext/filters/client_channel/parse_address.c +170 -0
- data/src/core/ext/filters/client_channel/parse_address.h +54 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.c +63 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +89 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +139 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +59 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +325 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +234 -0
- data/src/core/ext/filters/client_channel/resolver.c +88 -0
- data/src/core/ext/filters/client_channel/resolver.h +101 -0
- data/src/core/ext/filters/client_channel/resolver_factory.c +56 -0
- data/src/core/ext/filters/client_channel/resolver_factory.h +85 -0
- data/src/core/ext/filters/client_channel/resolver_registry.c +174 -0
- data/src/core/ext/filters/client_channel/resolver_registry.h +84 -0
- data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
- data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
- data/src/core/ext/filters/client_channel/subchannel.c +835 -0
- data/src/core/ext/filters/client_channel/subchannel.h +203 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +262 -0
- data/src/core/ext/filters/client_channel/subchannel_index.h +77 -0
- data/src/core/ext/filters/client_channel/uri_parser.c +315 -0
- data/src/core/ext/filters/client_channel/uri_parser.h +65 -0
- data/src/core/ext/filters/load_reporting/load_reporting.c +106 -0
- data/src/core/ext/filters/load_reporting/load_reporting.h +73 -0
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +218 -0
- data/src/core/ext/filters/load_reporting/load_reporting_filter.h +42 -0
- data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.c +56 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.h +49 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +221 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +41 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +121 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +239 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +304 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +47 -0
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +59 -0
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +90 -0
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +101 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +236 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +67 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +241 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +54 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +43 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +2847 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +53 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +61 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.c +287 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.h +104 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +198 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +78 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +145 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +59 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +125 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +58 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +239 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +76 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +134 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +57 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +661 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +107 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +1734 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +129 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +383 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +112 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.c +105 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +48 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +88 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +63 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +852 -0
- data/src/core/ext/transport/chttp2/transport/parsing.c +825 -0
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +194 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.c +176 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.h +83 -0
- data/src/core/ext/transport/chttp2/transport/varint.c +65 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +75 -0
- data/src/core/ext/transport/chttp2/transport/writing.c +429 -0
- data/src/core/lib/channel/channel_args.c +355 -0
- data/src/core/lib/channel/channel_args.h +126 -0
- data/src/core/lib/channel/channel_stack.c +291 -0
- data/src/core/lib/channel/channel_stack.h +319 -0
- data/src/core/lib/channel/channel_stack_builder.c +284 -0
- data/src/core/lib/channel/channel_stack_builder.h +170 -0
- data/src/core/lib/channel/compress_filter.c +353 -0
- data/src/core/lib/channel/compress_filter.h +67 -0
- data/src/core/lib/channel/connected_channel.c +188 -0
- data/src/core/lib/channel/connected_channel.h +48 -0
- data/src/core/lib/channel/context.h +64 -0
- data/src/core/lib/channel/deadline_filter.c +348 -0
- data/src/core/lib/channel/deadline_filter.h +102 -0
- data/src/core/lib/channel/handshaker.c +281 -0
- data/src/core/lib/channel/handshaker.h +182 -0
- data/src/core/lib/channel/handshaker_factory.c +54 -0
- data/src/core/lib/channel/handshaker_factory.h +66 -0
- data/src/core/lib/channel/handshaker_registry.c +113 -0
- data/src/core/lib/channel/handshaker_registry.h +63 -0
- data/src/core/lib/channel/http_client_filter.c +601 -0
- data/src/core/lib/channel/http_client_filter.h +47 -0
- data/src/core/lib/channel/http_server_filter.c +445 -0
- data/src/core/lib/channel/http_server_filter.h +42 -0
- data/src/core/lib/channel/message_size_filter.c +270 -0
- data/src/core/lib/channel/message_size_filter.h +39 -0
- data/src/core/lib/compression/algorithm_metadata.h +53 -0
- data/src/core/lib/compression/compression.c +198 -0
- data/src/core/lib/compression/message_compress.c +204 -0
- data/src/core/lib/compression/message_compress.h +54 -0
- data/src/core/lib/debug/trace.c +140 -0
- data/src/core/lib/debug/trace.h +43 -0
- data/src/core/lib/http/format_request.c +135 -0
- data/src/core/lib/http/format_request.h +47 -0
- data/src/core/lib/http/httpcli.c +336 -0
- data/src/core/lib/http/httpcli.h +141 -0
- data/src/core/lib/http/httpcli_security_connector.c +199 -0
- data/src/core/lib/http/parser.c +379 -0
- data/src/core/lib/http/parser.h +126 -0
- data/src/core/lib/iomgr/closure.c +168 -0
- data/src/core/lib/iomgr/closure.h +153 -0
- data/src/core/lib/iomgr/combiner.c +460 -0
- data/src/core/lib/iomgr/combiner.h +83 -0
- data/src/core/lib/iomgr/endpoint.c +78 -0
- data/src/core/lib/iomgr/endpoint.h +117 -0
- data/src/core/lib/iomgr/endpoint_pair.h +47 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.c +87 -0
- data/src/core/lib/iomgr/endpoint_pair_uv.c +53 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.c +101 -0
- data/src/core/lib/iomgr/error.c +793 -0
- data/src/core/lib/iomgr/error.h +218 -0
- data/src/core/lib/iomgr/error_internal.h +75 -0
- data/src/core/lib/iomgr/ev_epoll_linux.c +1965 -0
- data/src/core/lib/iomgr/ev_epoll_linux.h +48 -0
- data/src/core/lib/iomgr/ev_poll_posix.c +1593 -0
- data/src/core/lib/iomgr/ev_poll_posix.h +42 -0
- data/src/core/lib/iomgr/ev_posix.c +287 -0
- data/src/core/lib/iomgr/ev_posix.h +189 -0
- data/src/core/lib/iomgr/exec_ctx.c +117 -0
- data/src/core/lib/iomgr/exec_ctx.h +117 -0
- data/src/core/lib/iomgr/executor.c +170 -0
- data/src/core/lib/iomgr/executor.h +51 -0
- data/src/core/lib/iomgr/iocp_windows.c +168 -0
- data/src/core/lib/iomgr/iocp_windows.h +55 -0
- data/src/core/lib/iomgr/iomgr.c +183 -0
- data/src/core/lib/iomgr/iomgr.h +47 -0
- data/src/core/lib/iomgr/iomgr_internal.h +58 -0
- data/src/core/lib/iomgr/iomgr_posix.c +56 -0
- data/src/core/lib/iomgr/iomgr_posix.h +39 -0
- data/src/core/lib/iomgr/iomgr_uv.c +49 -0
- data/src/core/lib/iomgr/iomgr_windows.c +76 -0
- data/src/core/lib/iomgr/load_file.c +92 -0
- data/src/core/lib/iomgr/load_file.h +56 -0
- data/src/core/lib/iomgr/lockfree_event.c +238 -0
- data/src/core/lib/iomgr/lockfree_event.h +54 -0
- data/src/core/lib/iomgr/network_status_tracker.c +48 -0
- data/src/core/lib/iomgr/network_status_tracker.h +45 -0
- data/src/core/lib/iomgr/polling_entity.c +104 -0
- data/src/core/lib/iomgr/polling_entity.h +81 -0
- data/src/core/lib/iomgr/pollset.h +97 -0
- data/src/core/lib/iomgr/pollset_set.h +62 -0
- data/src/core/lib/iomgr/pollset_set_uv.c +63 -0
- data/src/core/lib/iomgr/pollset_set_windows.c +64 -0
- data/src/core/lib/iomgr/pollset_set_windows.h +39 -0
- data/src/core/lib/iomgr/pollset_uv.c +156 -0
- data/src/core/lib/iomgr/pollset_uv.h +42 -0
- data/src/core/lib/iomgr/pollset_windows.c +232 -0
- data/src/core/lib/iomgr/pollset_windows.h +78 -0
- data/src/core/lib/iomgr/port.h +138 -0
- data/src/core/lib/iomgr/resolve_address.h +70 -0
- data/src/core/lib/iomgr/resolve_address_posix.c +207 -0
- data/src/core/lib/iomgr/resolve_address_uv.c +284 -0
- data/src/core/lib/iomgr/resolve_address_windows.c +190 -0
- data/src/core/lib/iomgr/resource_quota.c +877 -0
- data/src/core/lib/iomgr/resource_quota.h +167 -0
- data/src/core/lib/iomgr/sockaddr.h +55 -0
- data/src/core/lib/iomgr/sockaddr_posix.h +44 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +272 -0
- data/src/core/lib/iomgr/sockaddr_utils.h +93 -0
- data/src/core/lib/iomgr/sockaddr_windows.h +43 -0
- data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
- data/src/core/lib/iomgr/socket_mutator.c +98 -0
- data/src/core/lib/iomgr/socket_mutator.h +80 -0
- data/src/core/lib/iomgr/socket_utils.h +42 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.c +330 -0
- data/src/core/lib/iomgr/socket_utils_linux.c +57 -0
- data/src/core/lib/iomgr/socket_utils_posix.c +73 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +147 -0
- data/src/core/lib/iomgr/socket_utils_uv.c +49 -0
- data/src/core/lib/iomgr/socket_utils_windows.c +52 -0
- data/src/core/lib/iomgr/socket_windows.c +167 -0
- data/src/core/lib/iomgr/socket_windows.h +125 -0
- data/src/core/lib/iomgr/tcp_client.h +55 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +368 -0
- data/src/core/lib/iomgr/tcp_client_posix.h +45 -0
- data/src/core/lib/iomgr/tcp_client_uv.c +192 -0
- data/src/core/lib/iomgr/tcp_client_windows.c +260 -0
- data/src/core/lib/iomgr/tcp_posix.c +677 -0
- data/src/core/lib/iomgr/tcp_posix.h +70 -0
- data/src/core/lib/iomgr/tcp_server.h +116 -0
- data/src/core/lib/iomgr/tcp_server_posix.c +579 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
- data/src/core/lib/iomgr/tcp_server_uv.c +393 -0
- data/src/core/lib/iomgr/tcp_server_windows.c +558 -0
- data/src/core/lib/iomgr/tcp_uv.c +374 -0
- data/src/core/lib/iomgr/tcp_uv.h +59 -0
- data/src/core/lib/iomgr/tcp_windows.c +462 -0
- data/src/core/lib/iomgr/tcp_windows.h +59 -0
- data/src/core/lib/iomgr/time_averaged_stats.c +77 -0
- data/src/core/lib/iomgr/time_averaged_stats.h +88 -0
- data/src/core/lib/iomgr/timer.h +111 -0
- data/src/core/lib/iomgr/timer_generic.c +567 -0
- data/src/core/lib/iomgr/timer_generic.h +49 -0
- data/src/core/lib/iomgr/timer_heap.c +152 -0
- data/src/core/lib/iomgr/timer_heap.h +57 -0
- data/src/core/lib/iomgr/timer_uv.c +103 -0
- data/src/core/lib/iomgr/timer_uv.h +47 -0
- data/src/core/lib/iomgr/udp_server.c +529 -0
- data/src/core/lib/iomgr/udp_server.h +89 -0
- data/src/core/lib/iomgr/unix_sockets_posix.c +108 -0
- data/src/core/lib/iomgr/unix_sockets_posix.h +56 -0
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +62 -0
- data/src/core/lib/iomgr/wakeup_fd_cv.c +118 -0
- data/src/core/lib/iomgr/wakeup_fd_cv.h +80 -0
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +97 -0
- data/src/core/lib/iomgr/wakeup_fd_nospecial.c +51 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +112 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +41 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.c +101 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +109 -0
- data/src/core/lib/iomgr/workqueue.h +87 -0
- data/src/core/lib/iomgr/workqueue_uv.c +65 -0
- data/src/core/lib/iomgr/workqueue_uv.h +37 -0
- data/src/core/lib/iomgr/workqueue_windows.c +63 -0
- data/src/core/lib/iomgr/workqueue_windows.h +37 -0
- data/src/core/lib/json/json.c +63 -0
- data/src/core/lib/json/json.h +88 -0
- data/src/core/lib/json/json_common.h +49 -0
- data/src/core/lib/json/json_reader.c +675 -0
- data/src/core/lib/json/json_reader.h +160 -0
- data/src/core/lib/json/json_string.c +379 -0
- data/src/core/lib/json/json_writer.c +258 -0
- data/src/core/lib/json/json_writer.h +97 -0
- data/src/core/lib/profiling/basic_timers.c +298 -0
- data/src/core/lib/profiling/stap_timers.c +65 -0
- data/src/core/lib/profiling/timers.h +121 -0
- data/src/core/lib/security/context/security_context.c +350 -0
- data/src/core/lib/security/context/security_context.h +134 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.c +274 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
- data/src/core/lib/security/credentials/credentials.c +308 -0
- data/src/core/lib/security/credentials/credentials.h +268 -0
- data/src/core/lib/security/credentials/credentials_metadata.c +103 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.c +141 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +71 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.c +54 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +337 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +60 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
- data/src/core/lib/security/credentials/jwt/json_token.c +321 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +88 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +195 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +63 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +910 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +140 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +468 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +153 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +242 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
- data/src/core/lib/security/transport/auth_filters.h +42 -0
- data/src/core/lib/security/transport/client_auth_filter.c +384 -0
- data/src/core/lib/security/transport/lb_targets_info.c +70 -0
- data/src/core/lib/security/transport/lb_targets_info.h +47 -0
- data/src/core/lib/security/transport/secure_endpoint.c +427 -0
- data/src/core/lib/security/transport/secure_endpoint.h +49 -0
- data/src/core/lib/security/transport/security_connector.c +909 -0
- data/src/core/lib/security/transport/security_connector.h +252 -0
- data/src/core/lib/security/transport/security_handshaker.c +507 -0
- data/src/core/lib/security/transport/security_handshaker.h +49 -0
- data/src/core/lib/security/transport/server_auth_filter.c +277 -0
- data/src/core/lib/security/transport/tsi_error.c +42 -0
- data/src/core/lib/security/transport/tsi_error.h +42 -0
- data/src/core/lib/security/util/json_util.c +61 -0
- data/src/core/lib/security/util/json_util.h +55 -0
- data/src/core/lib/slice/b64.c +251 -0
- data/src/core/lib/slice/b64.h +65 -0
- data/src/core/lib/slice/percent_encoding.c +182 -0
- data/src/core/lib/slice/percent_encoding.h +78 -0
- data/src/core/lib/slice/slice.c +466 -0
- data/src/core/lib/slice/slice_buffer.c +355 -0
- data/src/core/lib/slice/slice_hash_table.c +125 -0
- data/src/core/lib/slice/slice_hash_table.h +77 -0
- data/src/core/lib/slice/slice_intern.c +346 -0
- data/src/core/lib/slice/slice_internal.h +64 -0
- data/src/core/lib/slice/slice_string_helpers.c +95 -0
- data/src/core/lib/slice/slice_string_helpers.h +63 -0
- data/src/core/lib/support/alloc.c +117 -0
- data/src/core/lib/support/arena.c +98 -0
- data/src/core/lib/support/arena.h +54 -0
- data/src/core/lib/support/atm.c +47 -0
- data/src/core/lib/support/avl.c +299 -0
- data/src/core/lib/support/backoff.c +87 -0
- data/src/core/lib/support/backoff.h +71 -0
- data/src/core/lib/support/block_annotate.h +48 -0
- data/src/core/lib/support/cmdline.c +345 -0
- data/src/core/lib/support/cpu_iphone.c +49 -0
- data/src/core/lib/support/cpu_linux.c +83 -0
- data/src/core/lib/support/cpu_posix.c +72 -0
- data/src/core/lib/support/cpu_windows.c +47 -0
- data/src/core/lib/support/env.h +58 -0
- data/src/core/lib/support/env_linux.c +89 -0
- data/src/core/lib/support/env_posix.c +57 -0
- data/src/core/lib/support/env_windows.c +79 -0
- data/src/core/lib/support/histogram.c +243 -0
- data/src/core/lib/support/host_port.c +110 -0
- data/src/core/lib/support/log.c +103 -0
- data/src/core/lib/support/log_android.c +87 -0
- data/src/core/lib/support/log_linux.c +105 -0
- data/src/core/lib/support/log_posix.c +106 -0
- data/src/core/lib/support/log_windows.c +112 -0
- data/src/core/lib/support/mpscq.c +83 -0
- data/src/core/lib/support/mpscq.h +65 -0
- data/src/core/lib/support/murmur_hash.c +94 -0
- data/src/core/lib/support/murmur_hash.h +44 -0
- data/src/core/lib/support/spinlock.h +52 -0
- data/src/core/lib/support/stack_lockfree.c +185 -0
- data/src/core/lib/support/stack_lockfree.h +53 -0
- data/src/core/lib/support/string.c +315 -0
- data/src/core/lib/support/string.h +128 -0
- data/src/core/lib/support/string_posix.c +86 -0
- data/src/core/lib/support/string_util_windows.c +94 -0
- data/src/core/lib/support/string_windows.c +83 -0
- data/src/core/lib/support/string_windows.h +47 -0
- data/src/core/lib/support/subprocess_posix.c +114 -0
- data/src/core/lib/support/subprocess_windows.c +141 -0
- data/src/core/lib/support/sync.c +137 -0
- data/src/core/lib/support/sync_posix.c +113 -0
- data/src/core/lib/support/sync_windows.c +133 -0
- data/src/core/lib/support/thd.c +64 -0
- data/src/core/lib/support/thd_internal.h +39 -0
- data/src/core/lib/support/thd_posix.c +95 -0
- data/src/core/lib/support/thd_windows.c +117 -0
- data/src/core/lib/support/time.c +262 -0
- data/src/core/lib/support/time_posix.c +176 -0
- data/src/core/lib/support/time_precise.c +89 -0
- data/src/core/lib/support/time_precise.h +42 -0
- data/src/core/lib/support/time_windows.c +116 -0
- data/src/core/lib/support/tls_pthread.c +45 -0
- data/src/core/lib/support/tmpfile.h +53 -0
- data/src/core/lib/support/tmpfile_msys.c +73 -0
- data/src/core/lib/support/tmpfile_posix.c +85 -0
- data/src/core/lib/support/tmpfile_windows.c +84 -0
- data/src/core/lib/support/wrap_memcpy.c +55 -0
- data/src/core/lib/surface/alarm.c +87 -0
- data/src/core/lib/surface/api_trace.c +36 -0
- data/src/core/lib/surface/api_trace.h +65 -0
- data/src/core/lib/surface/byte_buffer.c +103 -0
- data/src/core/lib/surface/byte_buffer_reader.c +140 -0
- data/src/core/lib/surface/call.c +1835 -0
- data/src/core/lib/surface/call.h +135 -0
- data/src/core/lib/surface/call_details.c +56 -0
- data/src/core/lib/surface/call_log_batch.c +131 -0
- data/src/core/lib/surface/call_test_only.h +64 -0
- data/src/core/lib/surface/channel.c +434 -0
- data/src/core/lib/surface/channel.h +99 -0
- data/src/core/lib/surface/channel_init.c +140 -0
- data/src/core/lib/surface/channel_init.h +96 -0
- data/src/core/lib/surface/channel_ping.c +80 -0
- data/src/core/lib/surface/channel_stack_type.c +54 -0
- data/src/core/lib/surface/channel_stack_type.h +58 -0
- data/src/core/lib/surface/completion_queue.c +692 -0
- data/src/core/lib/surface/completion_queue.h +102 -0
- data/src/core/lib/surface/completion_queue_factory.c +77 -0
- data/src/core/lib/surface/completion_queue_factory.h +51 -0
- data/src/core/lib/surface/event_string.c +81 -0
- data/src/core/lib/surface/event_string.h +42 -0
- data/src/core/lib/surface/init.c +261 -0
- data/src/core/lib/surface/init.h +42 -0
- data/src/core/lib/surface/init_secure.c +94 -0
- data/src/core/lib/surface/lame_client.c +188 -0
- data/src/core/lib/surface/lame_client.h +41 -0
- data/src/core/lib/surface/metadata_array.c +49 -0
- data/src/core/lib/surface/server.c +1529 -0
- data/src/core/lib/surface/server.h +71 -0
- data/src/core/lib/surface/validate_metadata.c +108 -0
- data/src/core/lib/surface/validate_metadata.h +43 -0
- data/src/core/lib/surface/version.c +41 -0
- data/src/core/lib/transport/bdp_estimator.c +104 -0
- data/src/core/lib/transport/bdp_estimator.h +76 -0
- data/src/core/lib/transport/byte_stream.c +81 -0
- data/src/core/lib/transport/byte_stream.h +85 -0
- data/src/core/lib/transport/connectivity_state.c +219 -0
- data/src/core/lib/transport/connectivity_state.h +101 -0
- data/src/core/lib/transport/error_utils.c +124 -0
- data/src/core/lib/transport/error_utils.h +56 -0
- data/src/core/lib/transport/http2_errors.h +56 -0
- data/src/core/lib/transport/metadata.c +529 -0
- data/src/core/lib/transport/metadata.h +186 -0
- data/src/core/lib/transport/metadata_batch.c +328 -0
- data/src/core/lib/transport/metadata_batch.h +166 -0
- data/src/core/lib/transport/pid_controller.c +78 -0
- data/src/core/lib/transport/pid_controller.h +77 -0
- data/src/core/lib/transport/service_config.c +266 -0
- data/src/core/lib/transport/service_config.h +77 -0
- data/src/core/lib/transport/static_metadata.c +801 -0
- data/src/core/lib/transport/static_metadata.h +557 -0
- data/src/core/lib/transport/status_conversion.c +113 -0
- data/src/core/lib/transport/status_conversion.h +49 -0
- data/src/core/lib/transport/timeout_encoding.c +190 -0
- data/src/core/lib/transport/timeout_encoding.h +49 -0
- data/src/core/lib/transport/transport.c +282 -0
- data/src/core/lib/transport/transport.h +354 -0
- data/src/core/lib/transport/transport_impl.h +90 -0
- data/src/core/lib/transport/transport_op_string.c +217 -0
- data/src/core/plugin_registry/grpc_plugin_registry.c +82 -0
- data/src/core/tsi/fake_transport_security.c +527 -0
- data/src/core/tsi/fake_transport_security.h +61 -0
- data/src/core/tsi/ssl_transport_security.c +1533 -0
- data/src/core/tsi/ssl_transport_security.h +214 -0
- data/src/core/tsi/ssl_types.h +55 -0
- data/src/core/tsi/transport_security.c +266 -0
- data/src/core/tsi/transport_security.h +111 -0
- data/src/core/tsi/transport_security_interface.h +353 -0
- data/src/ruby/bin/apis/google/protobuf/empty.rb +44 -0
- data/src/ruby/bin/apis/pubsub_demo.rb +256 -0
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +174 -0
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +103 -0
- data/src/ruby/bin/math_client.rb +147 -0
- data/src/ruby/bin/math_pb.rb +32 -0
- data/src/ruby/bin/math_server.rb +206 -0
- data/src/ruby/bin/math_services_pb.rb +66 -0
- data/src/ruby/bin/noproto_client.rb +108 -0
- data/src/ruby/bin/noproto_server.rb +112 -0
- data/src/ruby/ext/grpc/extconf.rb +131 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.c +77 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.h +50 -0
- data/src/ruby/ext/grpc/rb_call.c +1009 -0
- data/src/ruby/ext/grpc/rb_call.h +66 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +295 -0
- data/src/ruby/ext/grpc/rb_call_credentials.h +46 -0
- data/src/ruby/ext/grpc/rb_channel.c +662 -0
- data/src/ruby/ext/grpc/rb_channel.h +49 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +168 -0
- data/src/ruby/ext/grpc/rb_channel_args.h +53 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +268 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.h +47 -0
- data/src/ruby/ext/grpc/rb_completion_queue.c +117 -0
- data/src/ruby/ext/grpc/rb_completion_queue.h +51 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +472 -0
- data/src/ruby/ext/grpc/rb_compression_options.h +44 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +158 -0
- data/src/ruby/ext/grpc/rb_event_thread.h +37 -0
- data/src/ruby/ext/grpc/rb_grpc.c +343 -0
- data/src/ruby/ext/grpc/rb_grpc.h +87 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +634 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +955 -0
- data/src/ruby/ext/grpc/rb_loader.c +72 -0
- data/src/ruby/ext/grpc/rb_loader.h +40 -0
- data/src/ruby/ext/grpc/rb_server.c +359 -0
- data/src/ruby/ext/grpc/rb_server.h +47 -0
- data/src/ruby/ext/grpc/rb_server_credentials.c +258 -0
- data/src/ruby/ext/grpc/rb_server_credentials.h +47 -0
- data/src/ruby/lib/grpc/core/time_consts.rb +71 -0
- data/src/ruby/lib/grpc/errors.rb +215 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +547 -0
- data/src/ruby/lib/grpc/generic/bidi_call.rb +229 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +463 -0
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +173 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +476 -0
- data/src/ruby/lib/grpc/generic/service.rb +225 -0
- data/src/ruby/lib/grpc/grpc.rb +39 -0
- data/src/ruby/lib/grpc/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/logconfig.rb +59 -0
- data/src/ruby/lib/grpc/notifier.rb +60 -0
- data/src/ruby/lib/grpc/version.rb +33 -0
- data/src/ruby/lib/grpc.rb +49 -0
- data/src/ruby/pb/README.md +42 -0
- data/src/ruby/pb/generate_proto_ruby.sh +58 -0
- data/src/ruby/pb/grpc/health/checker.rb +77 -0
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +28 -0
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +56 -0
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +58 -0
- data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +64 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +15 -0
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +82 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +14 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +117 -0
- data/src/ruby/pb/test/client.rb +779 -0
- data/src/ruby/pb/test/server.rb +267 -0
- data/src/ruby/spec/call_credentials_spec.rb +57 -0
- data/src/ruby/spec/call_spec.rb +162 -0
- data/src/ruby/spec/channel_connection_spec.rb +141 -0
- data/src/ruby/spec/channel_credentials_spec.rb +97 -0
- data/src/ruby/spec/channel_spec.rb +205 -0
- data/src/ruby/spec/client_server_spec.rb +491 -0
- data/src/ruby/spec/compression_options_spec.rb +164 -0
- data/src/ruby/spec/error_sanity_spec.rb +64 -0
- data/src/ruby/spec/generic/active_call_spec.rb +632 -0
- data/src/ruby/spec/generic/client_stub_spec.rb +556 -0
- data/src/ruby/spec/generic/rpc_desc_spec.rb +351 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +142 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +524 -0
- data/src/ruby/spec/generic/service_spec.rb +276 -0
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +71 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +222 -0
- data/src/ruby/spec/server_credentials_spec.rb +94 -0
- data/src/ruby/spec/server_spec.rb +205 -0
- data/src/ruby/spec/spec_helper.rb +71 -0
- data/src/ruby/spec/testdata/README +1 -0
- data/src/ruby/spec/testdata/ca.pem +15 -0
- data/src/ruby/spec/testdata/server1.key +16 -0
- data/src/ruby/spec/testdata/server1.pem +16 -0
- data/src/ruby/spec/time_consts_spec.rb +89 -0
- data/third_party/boringssl/crypto/aes/aes.c +1142 -0
- data/third_party/boringssl/crypto/aes/internal.h +87 -0
- data/third_party/boringssl/crypto/aes/mode_wrappers.c +112 -0
- data/third_party/boringssl/crypto/asn1/a_bitstr.c +263 -0
- data/third_party/boringssl/crypto/asn1/a_bool.c +110 -0
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +282 -0
- data/third_party/boringssl/crypto/asn1/a_dup.c +111 -0
- data/third_party/boringssl/crypto/asn1/a_enum.c +181 -0
- data/third_party/boringssl/crypto/asn1/a_gentm.c +256 -0
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +147 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +460 -0
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +409 -0
- data/third_party/boringssl/crypto/asn1/a_object.c +400 -0
- data/third_party/boringssl/crypto/asn1/a_octet.c +77 -0
- data/third_party/boringssl/crypto/asn1/a_print.c +121 -0
- data/third_party/boringssl/crypto/asn1/a_strnid.c +309 -0
- data/third_party/boringssl/crypto/asn1/a_time.c +206 -0
- data/third_party/boringssl/crypto/asn1/a_type.c +151 -0
- data/third_party/boringssl/crypto/asn1/a_utctm.c +304 -0
- data/third_party/boringssl/crypto/asn1/a_utf8.c +234 -0
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +483 -0
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +63 -0
- data/third_party/boringssl/crypto/asn1/asn1_par.c +80 -0
- data/third_party/boringssl/crypto/asn1/asn_pack.c +105 -0
- data/third_party/boringssl/crypto/asn1/f_enum.c +93 -0
- data/third_party/boringssl/crypto/asn1/f_int.c +97 -0
- data/third_party/boringssl/crypto/asn1/f_string.c +91 -0
- data/third_party/boringssl/crypto/asn1/t_bitst.c +103 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +1221 -0
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +665 -0
- data/third_party/boringssl/crypto/asn1/tasn_fre.c +246 -0
- data/third_party/boringssl/crypto/asn1/tasn_new.c +381 -0
- data/third_party/boringssl/crypto/asn1/tasn_typ.c +131 -0
- data/third_party/boringssl/crypto/asn1/tasn_utl.c +266 -0
- data/third_party/boringssl/crypto/asn1/x_bignum.c +153 -0
- data/third_party/boringssl/crypto/asn1/x_long.c +197 -0
- data/third_party/boringssl/crypto/base64/base64.c +442 -0
- data/third_party/boringssl/crypto/bio/bio.c +598 -0
- data/third_party/boringssl/crypto/bio/bio_mem.c +328 -0
- data/third_party/boringssl/crypto/bio/buffer.c +496 -0
- data/third_party/boringssl/crypto/bio/connect.c +553 -0
- data/third_party/boringssl/crypto/bio/fd.c +277 -0
- data/third_party/boringssl/crypto/bio/file.c +313 -0
- data/third_party/boringssl/crypto/bio/hexdump.c +191 -0
- data/third_party/boringssl/crypto/bio/internal.h +111 -0
- data/third_party/boringssl/crypto/bio/pair.c +803 -0
- data/third_party/boringssl/crypto/bio/printf.c +119 -0
- data/third_party/boringssl/crypto/bio/socket.c +203 -0
- data/third_party/boringssl/crypto/bio/socket_helper.c +113 -0
- data/third_party/boringssl/crypto/bn/add.c +377 -0
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +531 -0
- data/third_party/boringssl/crypto/bn/bn.c +379 -0
- data/third_party/boringssl/crypto/bn/bn_asn1.c +80 -0
- data/third_party/boringssl/crypto/bn/cmp.c +225 -0
- data/third_party/boringssl/crypto/bn/convert.c +599 -0
- data/third_party/boringssl/crypto/bn/ctx.c +311 -0
- data/third_party/boringssl/crypto/bn/div.c +671 -0
- data/third_party/boringssl/crypto/bn/exponentiation.c +1258 -0
- data/third_party/boringssl/crypto/bn/gcd.c +628 -0
- data/third_party/boringssl/crypto/bn/generic.c +703 -0
- data/third_party/boringssl/crypto/bn/internal.h +245 -0
- data/third_party/boringssl/crypto/bn/kronecker.c +175 -0
- data/third_party/boringssl/crypto/bn/montgomery.c +410 -0
- data/third_party/boringssl/crypto/bn/montgomery_inv.c +160 -0
- data/third_party/boringssl/crypto/bn/mul.c +869 -0
- data/third_party/boringssl/crypto/bn/prime.c +861 -0
- data/third_party/boringssl/crypto/bn/random.c +340 -0
- data/third_party/boringssl/crypto/bn/rsaz_exp.c +319 -0
- data/third_party/boringssl/crypto/bn/rsaz_exp.h +56 -0
- data/third_party/boringssl/crypto/bn/shift.c +299 -0
- data/third_party/boringssl/crypto/bn/sqrt.c +504 -0
- data/third_party/boringssl/crypto/buf/buf.c +239 -0
- data/third_party/boringssl/crypto/bytestring/asn1_compat.c +51 -0
- data/third_party/boringssl/crypto/bytestring/ber.c +263 -0
- data/third_party/boringssl/crypto/bytestring/cbb.c +473 -0
- data/third_party/boringssl/crypto/bytestring/cbs.c +439 -0
- data/third_party/boringssl/crypto/bytestring/internal.h +75 -0
- data/third_party/boringssl/crypto/chacha/chacha.c +167 -0
- data/third_party/boringssl/crypto/cipher/aead.c +156 -0
- data/third_party/boringssl/crypto/cipher/cipher.c +652 -0
- data/third_party/boringssl/crypto/cipher/derive_key.c +154 -0
- data/third_party/boringssl/crypto/cipher/e_aes.c +1717 -0
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +300 -0
- data/third_party/boringssl/crypto/cipher/e_des.c +205 -0
- data/third_party/boringssl/crypto/cipher/e_null.c +85 -0
- data/third_party/boringssl/crypto/cipher/e_rc2.c +443 -0
- data/third_party/boringssl/crypto/cipher/e_rc4.c +87 -0
- data/third_party/boringssl/crypto/cipher/e_ssl3.c +403 -0
- data/third_party/boringssl/crypto/cipher/e_tls.c +602 -0
- data/third_party/boringssl/crypto/cipher/internal.h +162 -0
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +553 -0
- data/third_party/boringssl/crypto/cmac/cmac.c +239 -0
- data/third_party/boringssl/crypto/conf/conf.c +788 -0
- data/third_party/boringssl/crypto/conf/conf_def.h +127 -0
- data/third_party/boringssl/crypto/conf/internal.h +31 -0
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +61 -0
- data/third_party/boringssl/crypto/cpu-arm-linux.c +360 -0
- data/third_party/boringssl/crypto/cpu-arm.c +38 -0
- data/third_party/boringssl/crypto/cpu-intel.c +263 -0
- data/third_party/boringssl/crypto/cpu-ppc64le.c +40 -0
- data/third_party/boringssl/crypto/crypto.c +164 -0
- data/third_party/boringssl/crypto/curve25519/curve25519.c +4944 -0
- data/third_party/boringssl/crypto/curve25519/internal.h +109 -0
- data/third_party/boringssl/crypto/curve25519/spake25519.c +464 -0
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +246 -0
- data/third_party/boringssl/crypto/des/des.c +771 -0
- data/third_party/boringssl/crypto/des/internal.h +212 -0
- data/third_party/boringssl/crypto/dh/check.c +218 -0
- data/third_party/boringssl/crypto/dh/dh.c +487 -0
- data/third_party/boringssl/crypto/dh/dh_asn1.c +160 -0
- data/third_party/boringssl/crypto/dh/params.c +253 -0
- data/third_party/boringssl/crypto/digest/digest.c +248 -0
- data/third_party/boringssl/crypto/digest/digests.c +321 -0
- data/third_party/boringssl/crypto/digest/internal.h +112 -0
- data/third_party/boringssl/crypto/digest/md32_common.h +262 -0
- data/third_party/boringssl/crypto/dsa/dsa.c +964 -0
- data/third_party/boringssl/crypto/dsa/dsa_asn1.c +339 -0
- data/third_party/boringssl/crypto/ec/ec.c +847 -0
- data/third_party/boringssl/crypto/ec/ec_asn1.c +549 -0
- data/third_party/boringssl/crypto/ec/ec_key.c +479 -0
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +308 -0
- data/third_party/boringssl/crypto/ec/internal.h +276 -0
- data/third_party/boringssl/crypto/ec/oct.c +428 -0
- data/third_party/boringssl/crypto/ec/p224-64.c +1187 -0
- data/third_party/boringssl/crypto/ec/p256-64.c +1741 -0
- data/third_party/boringssl/crypto/ec/p256-x86_64-table.h +9543 -0
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +574 -0
- data/third_party/boringssl/crypto/ec/simple.c +1117 -0
- data/third_party/boringssl/crypto/ec/util-64.c +109 -0
- data/third_party/boringssl/crypto/ec/wnaf.c +449 -0
- data/third_party/boringssl/crypto/ecdh/ecdh.c +159 -0
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +478 -0
- data/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c +227 -0
- data/third_party/boringssl/crypto/engine/engine.c +96 -0
- data/third_party/boringssl/crypto/err/err.c +756 -0
- data/third_party/boringssl/crypto/evp/digestsign.c +159 -0
- data/third_party/boringssl/crypto/evp/evp.c +367 -0
- data/third_party/boringssl/crypto/evp/evp_asn1.c +337 -0
- data/third_party/boringssl/crypto/evp/evp_ctx.c +448 -0
- data/third_party/boringssl/crypto/evp/internal.h +237 -0
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +268 -0
- data/third_party/boringssl/crypto/evp/p_ec.c +236 -0
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +257 -0
- data/third_party/boringssl/crypto/evp/p_rsa.c +673 -0
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +200 -0
- data/third_party/boringssl/crypto/evp/pbkdf.c +151 -0
- data/third_party/boringssl/crypto/evp/print.c +520 -0
- data/third_party/boringssl/crypto/evp/sign.c +151 -0
- data/third_party/boringssl/crypto/ex_data.c +292 -0
- data/third_party/boringssl/crypto/hkdf/hkdf.c +110 -0
- data/third_party/boringssl/crypto/hmac/hmac.c +213 -0
- data/third_party/boringssl/crypto/internal.h +527 -0
- data/third_party/boringssl/crypto/lhash/lhash.c +342 -0
- data/third_party/boringssl/crypto/md4/md4.c +234 -0
- data/third_party/boringssl/crypto/md5/md5.c +275 -0
- data/third_party/boringssl/crypto/mem.c +200 -0
- data/third_party/boringssl/crypto/modes/cbc.c +216 -0
- data/third_party/boringssl/crypto/modes/cfb.c +230 -0
- data/third_party/boringssl/crypto/modes/ctr.c +219 -0
- data/third_party/boringssl/crypto/modes/gcm.c +1288 -0
- data/third_party/boringssl/crypto/modes/internal.h +358 -0
- data/third_party/boringssl/crypto/modes/ofb.c +95 -0
- data/third_party/boringssl/crypto/newhope/error_correction.c +131 -0
- data/third_party/boringssl/crypto/newhope/internal.h +71 -0
- data/third_party/boringssl/crypto/newhope/newhope.c +174 -0
- data/third_party/boringssl/crypto/newhope/ntt.c +148 -0
- data/third_party/boringssl/crypto/newhope/poly.c +183 -0
- data/third_party/boringssl/crypto/newhope/precomp.c +306 -0
- data/third_party/boringssl/crypto/newhope/reduce.c +42 -0
- data/third_party/boringssl/crypto/obj/obj.c +640 -0
- data/third_party/boringssl/crypto/obj/obj_dat.h +5254 -0
- data/third_party/boringssl/crypto/obj/obj_xref.c +124 -0
- data/third_party/boringssl/crypto/obj/obj_xref.h +96 -0
- data/third_party/boringssl/crypto/pem/pem_all.c +262 -0
- data/third_party/boringssl/crypto/pem/pem_info.c +381 -0
- data/third_party/boringssl/crypto/pem/pem_lib.c +778 -0
- data/third_party/boringssl/crypto/pem/pem_oth.c +88 -0
- data/third_party/boringssl/crypto/pem/pem_pk8.c +257 -0
- data/third_party/boringssl/crypto/pem/pem_pkey.c +227 -0
- data/third_party/boringssl/crypto/pem/pem_x509.c +65 -0
- data/third_party/boringssl/crypto/pem/pem_xaux.c +67 -0
- data/third_party/boringssl/crypto/pkcs8/internal.h +83 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +151 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +441 -0
- data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +85 -0
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +1219 -0
- data/third_party/boringssl/crypto/poly1305/internal.h +40 -0
- data/third_party/boringssl/crypto/poly1305/poly1305.c +324 -0
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +304 -0
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +890 -0
- data/third_party/boringssl/crypto/rand/deterministic.c +47 -0
- data/third_party/boringssl/crypto/rand/internal.h +32 -0
- data/third_party/boringssl/crypto/rand/rand.c +244 -0
- data/third_party/boringssl/crypto/rand/urandom.c +221 -0
- data/third_party/boringssl/crypto/rand/windows.c +53 -0
- data/third_party/boringssl/crypto/rc4/rc4.c +98 -0
- data/third_party/boringssl/crypto/refcount_c11.c +67 -0
- data/third_party/boringssl/crypto/refcount_lock.c +53 -0
- data/third_party/boringssl/crypto/rsa/blinding.c +264 -0
- data/third_party/boringssl/crypto/rsa/internal.h +148 -0
- data/third_party/boringssl/crypto/rsa/padding.c +708 -0
- data/third_party/boringssl/crypto/rsa/rsa.c +830 -0
- data/third_party/boringssl/crypto/rsa/rsa_asn1.c +446 -0
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +1139 -0
- data/third_party/boringssl/crypto/sha/sha1.c +337 -0
- data/third_party/boringssl/crypto/sha/sha256.c +327 -0
- data/third_party/boringssl/crypto/sha/sha512.c +607 -0
- data/third_party/boringssl/crypto/stack/stack.c +377 -0
- data/third_party/boringssl/crypto/thread.c +110 -0
- data/third_party/boringssl/crypto/thread_none.c +59 -0
- data/third_party/boringssl/crypto/thread_pthread.c +176 -0
- data/third_party/boringssl/crypto/thread_win.c +237 -0
- data/third_party/boringssl/crypto/time_support.c +206 -0
- data/third_party/boringssl/crypto/x509/a_digest.c +96 -0
- data/third_party/boringssl/crypto/x509/a_sign.c +135 -0
- data/third_party/boringssl/crypto/x509/a_strex.c +633 -0
- data/third_party/boringssl/crypto/x509/a_verify.c +127 -0
- data/third_party/boringssl/crypto/x509/algorithm.c +137 -0
- data/third_party/boringssl/crypto/x509/asn1_gen.c +818 -0
- data/third_party/boringssl/crypto/x509/by_dir.c +453 -0
- data/third_party/boringssl/crypto/x509/by_file.c +275 -0
- data/third_party/boringssl/crypto/x509/charmap.h +15 -0
- data/third_party/boringssl/crypto/x509/i2d_pr.c +83 -0
- data/third_party/boringssl/crypto/x509/internal.h +66 -0
- data/third_party/boringssl/crypto/x509/pkcs7.c +353 -0
- data/third_party/boringssl/crypto/x509/rsa_pss.c +385 -0
- data/third_party/boringssl/crypto/x509/t_crl.c +128 -0
- data/third_party/boringssl/crypto/x509/t_req.c +246 -0
- data/third_party/boringssl/crypto/x509/t_x509.c +506 -0
- data/third_party/boringssl/crypto/x509/t_x509a.c +111 -0
- data/third_party/boringssl/crypto/x509/vpm_int.h +70 -0
- data/third_party/boringssl/crypto/x509/x509.c +157 -0
- data/third_party/boringssl/crypto/x509/x509_att.c +381 -0
- data/third_party/boringssl/crypto/x509/x509_cmp.c +474 -0
- data/third_party/boringssl/crypto/x509/x509_d2.c +106 -0
- data/third_party/boringssl/crypto/x509/x509_def.c +98 -0
- data/third_party/boringssl/crypto/x509/x509_ext.c +206 -0
- data/third_party/boringssl/crypto/x509/x509_lu.c +690 -0
- data/third_party/boringssl/crypto/x509/x509_obj.c +197 -0
- data/third_party/boringssl/crypto/x509/x509_r2x.c +117 -0
- data/third_party/boringssl/crypto/x509/x509_req.c +322 -0
- data/third_party/boringssl/crypto/x509/x509_set.c +154 -0
- data/third_party/boringssl/crypto/x509/x509_trs.c +326 -0
- data/third_party/boringssl/crypto/x509/x509_txt.c +211 -0
- data/third_party/boringssl/crypto/x509/x509_v3.c +278 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +2436 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +647 -0
- data/third_party/boringssl/crypto/x509/x509cset.c +170 -0
- data/third_party/boringssl/crypto/x509/x509name.c +386 -0
- data/third_party/boringssl/crypto/x509/x509rset.c +81 -0
- data/third_party/boringssl/crypto/x509/x509spki.c +137 -0
- data/third_party/boringssl/crypto/x509/x509type.c +126 -0
- data/third_party/boringssl/crypto/x509/x_algor.c +151 -0
- data/third_party/boringssl/crypto/x509/x_all.c +501 -0
- data/third_party/boringssl/crypto/x509/x_attrib.c +111 -0
- data/third_party/boringssl/crypto/x509/x_crl.c +539 -0
- data/third_party/boringssl/crypto/x509/x_exten.c +75 -0
- data/third_party/boringssl/crypto/x509/x_info.c +98 -0
- data/third_party/boringssl/crypto/x509/x_name.c +534 -0
- data/third_party/boringssl/crypto/x509/x_pkey.c +103 -0
- data/third_party/boringssl/crypto/x509/x_pubkey.c +368 -0
- data/third_party/boringssl/crypto/x509/x_req.c +109 -0
- data/third_party/boringssl/crypto/x509/x_sig.c +69 -0
- data/third_party/boringssl/crypto/x509/x_spki.c +80 -0
- data/third_party/boringssl/crypto/x509/x_val.c +69 -0
- data/third_party/boringssl/crypto/x509/x_x509.c +289 -0
- data/third_party/boringssl/crypto/x509/x_x509a.c +205 -0
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +135 -0
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +284 -0
- data/third_party/boringssl/crypto/x509v3/pcy_data.c +130 -0
- data/third_party/boringssl/crypto/x509v3/pcy_int.h +217 -0
- data/third_party/boringssl/crypto/x509v3/pcy_lib.c +164 -0
- data/third_party/boringssl/crypto/x509v3/pcy_map.c +130 -0
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +188 -0
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +829 -0
- data/third_party/boringssl/crypto/x509v3/v3_akey.c +204 -0
- data/third_party/boringssl/crypto/x509v3/v3_akeya.c +72 -0
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +614 -0
- data/third_party/boringssl/crypto/x509v3/v3_bcons.c +133 -0
- data/third_party/boringssl/crypto/x509v3/v3_bitst.c +141 -0
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +462 -0
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +496 -0
- data/third_party/boringssl/crypto/x509v3/v3_crld.c +561 -0
- data/third_party/boringssl/crypto/x509v3/v3_enum.c +100 -0
- data/third_party/boringssl/crypto/x509v3/v3_extku.c +148 -0
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +250 -0
- data/third_party/boringssl/crypto/x509v3/v3_ia5.c +119 -0
- data/third_party/boringssl/crypto/x509v3/v3_info.c +212 -0
- data/third_party/boringssl/crypto/x509v3/v3_int.c +91 -0
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +362 -0
- data/third_party/boringssl/crypto/x509v3/v3_ncons.c +482 -0
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +317 -0
- data/third_party/boringssl/crypto/x509v3/v3_pcia.c +57 -0
- data/third_party/boringssl/crypto/x509v3/v3_pcons.c +139 -0
- data/third_party/boringssl/crypto/x509v3/v3_pku.c +110 -0
- data/third_party/boringssl/crypto/x509v3/v3_pmaps.c +154 -0
- data/third_party/boringssl/crypto/x509v3/v3_prn.c +229 -0
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +874 -0
- data/third_party/boringssl/crypto/x509v3/v3_skey.c +152 -0
- data/third_party/boringssl/crypto/x509v3/v3_sxnet.c +274 -0
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +1327 -0
- data/third_party/boringssl/include/openssl/aead.h +345 -0
- data/third_party/boringssl/include/openssl/aes.h +158 -0
- data/third_party/boringssl/include/openssl/arm_arch.h +121 -0
- data/third_party/boringssl/include/openssl/asn1.h +1038 -0
- data/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
- data/third_party/boringssl/include/openssl/asn1t.h +896 -0
- data/third_party/boringssl/include/openssl/base.h +412 -0
- data/third_party/boringssl/include/openssl/base64.h +187 -0
- data/third_party/boringssl/include/openssl/bio.h +926 -0
- data/third_party/boringssl/include/openssl/blowfish.h +93 -0
- data/third_party/boringssl/include/openssl/bn.h +955 -0
- data/third_party/boringssl/include/openssl/buf.h +133 -0
- data/third_party/boringssl/include/openssl/buffer.h +18 -0
- data/third_party/boringssl/include/openssl/bytestring.h +437 -0
- data/third_party/boringssl/include/openssl/cast.h +96 -0
- data/third_party/boringssl/include/openssl/chacha.h +37 -0
- data/third_party/boringssl/include/openssl/cipher.h +588 -0
- data/third_party/boringssl/include/openssl/cmac.h +87 -0
- data/third_party/boringssl/include/openssl/conf.h +181 -0
- data/third_party/boringssl/include/openssl/cpu.h +181 -0
- data/third_party/boringssl/include/openssl/crypto.h +94 -0
- data/third_party/boringssl/include/openssl/curve25519.h +183 -0
- data/third_party/boringssl/include/openssl/des.h +177 -0
- data/third_party/boringssl/include/openssl/dh.h +297 -0
- data/third_party/boringssl/include/openssl/digest.h +285 -0
- data/third_party/boringssl/include/openssl/dsa.h +436 -0
- data/third_party/boringssl/include/openssl/dtls1.h +16 -0
- data/third_party/boringssl/include/openssl/ec.h +406 -0
- data/third_party/boringssl/include/openssl/ec_key.h +337 -0
- data/third_party/boringssl/include/openssl/ecdh.h +102 -0
- data/third_party/boringssl/include/openssl/ecdsa.h +217 -0
- data/third_party/boringssl/include/openssl/engine.h +109 -0
- data/third_party/boringssl/include/openssl/err.h +488 -0
- data/third_party/boringssl/include/openssl/evp.h +797 -0
- data/third_party/boringssl/include/openssl/ex_data.h +213 -0
- data/third_party/boringssl/include/openssl/hkdf.h +64 -0
- data/third_party/boringssl/include/openssl/hmac.h +174 -0
- data/third_party/boringssl/include/openssl/lhash.h +192 -0
- data/third_party/boringssl/include/openssl/lhash_macros.h +132 -0
- data/third_party/boringssl/include/openssl/md4.h +106 -0
- data/third_party/boringssl/include/openssl/md5.h +107 -0
- data/third_party/boringssl/include/openssl/mem.h +150 -0
- data/third_party/boringssl/include/openssl/newhope.h +158 -0
- data/third_party/boringssl/include/openssl/nid.h +4166 -0
- data/third_party/boringssl/include/openssl/obj.h +226 -0
- data/third_party/boringssl/include/openssl/obj_mac.h +18 -0
- data/third_party/boringssl/include/openssl/objects.h +18 -0
- data/third_party/boringssl/include/openssl/opensslconf.h +60 -0
- data/third_party/boringssl/include/openssl/opensslv.h +18 -0
- data/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
- data/third_party/boringssl/include/openssl/pem.h +517 -0
- data/third_party/boringssl/include/openssl/pkcs12.h +18 -0
- data/third_party/boringssl/include/openssl/pkcs7.h +16 -0
- data/third_party/boringssl/include/openssl/pkcs8.h +236 -0
- data/third_party/boringssl/include/openssl/poly1305.h +51 -0
- data/third_party/boringssl/include/openssl/rand.h +122 -0
- data/third_party/boringssl/include/openssl/rc4.h +96 -0
- data/third_party/boringssl/include/openssl/ripemd.h +107 -0
- data/third_party/boringssl/include/openssl/rsa.h +699 -0
- data/third_party/boringssl/include/openssl/safestack.h +16 -0
- data/third_party/boringssl/include/openssl/sha.h +260 -0
- data/third_party/boringssl/include/openssl/srtp.h +18 -0
- data/third_party/boringssl/include/openssl/ssl.h +4826 -0
- data/third_party/boringssl/include/openssl/ssl3.h +434 -0
- data/third_party/boringssl/include/openssl/stack.h +293 -0
- data/third_party/boringssl/include/openssl/stack_macros.h +3902 -0
- data/third_party/boringssl/include/openssl/thread.h +191 -0
- data/third_party/boringssl/include/openssl/time_support.h +91 -0
- data/third_party/boringssl/include/openssl/tls1.h +657 -0
- data/third_party/boringssl/include/openssl/type_check.h +91 -0
- data/third_party/boringssl/include/openssl/x509.h +1299 -0
- data/third_party/boringssl/include/openssl/x509_vfy.h +618 -0
- data/third_party/boringssl/include/openssl/x509v3.h +819 -0
- data/third_party/boringssl/ssl/custom_extensions.c +255 -0
- data/third_party/boringssl/ssl/d1_both.c +845 -0
- data/third_party/boringssl/ssl/d1_lib.c +270 -0
- data/third_party/boringssl/ssl/d1_pkt.c +419 -0
- data/third_party/boringssl/ssl/d1_srtp.c +236 -0
- data/third_party/boringssl/ssl/dtls_method.c +203 -0
- data/third_party/boringssl/ssl/dtls_record.c +309 -0
- data/third_party/boringssl/ssl/handshake_client.c +2002 -0
- data/third_party/boringssl/ssl/handshake_server.c +1932 -0
- data/third_party/boringssl/ssl/internal.h +1551 -0
- data/third_party/boringssl/ssl/s3_both.c +745 -0
- data/third_party/boringssl/ssl/s3_enc.c +412 -0
- data/third_party/boringssl/ssl/s3_lib.c +336 -0
- data/third_party/boringssl/ssl/s3_pkt.c +497 -0
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +329 -0
- data/third_party/boringssl/ssl/ssl_asn1.c +748 -0
- data/third_party/boringssl/ssl/ssl_buffer.c +311 -0
- data/third_party/boringssl/ssl/ssl_cert.c +814 -0
- data/third_party/boringssl/ssl/ssl_cipher.c +2062 -0
- data/third_party/boringssl/ssl/ssl_ecdh.c +610 -0
- data/third_party/boringssl/ssl/ssl_file.c +586 -0
- data/third_party/boringssl/ssl/ssl_lib.c +3063 -0
- data/third_party/boringssl/ssl/ssl_rsa.c +793 -0
- data/third_party/boringssl/ssl/ssl_session.c +985 -0
- data/third_party/boringssl/ssl/ssl_stat.c +509 -0
- data/third_party/boringssl/ssl/t1_enc.c +547 -0
- data/third_party/boringssl/ssl/t1_lib.c +3279 -0
- data/third_party/boringssl/ssl/tls13_both.c +440 -0
- data/third_party/boringssl/ssl/tls13_client.c +682 -0
- data/third_party/boringssl/ssl/tls13_enc.c +391 -0
- data/third_party/boringssl/ssl/tls13_server.c +672 -0
- data/third_party/boringssl/ssl/tls_method.c +245 -0
- data/third_party/boringssl/ssl/tls_record.c +461 -0
- data/third_party/cares/ares_build.h +264 -0
- data/third_party/cares/cares/ares.h +636 -0
- data/third_party/cares/cares/ares__close_sockets.c +61 -0
- data/third_party/cares/cares/ares__get_hostent.c +261 -0
- data/third_party/cares/cares/ares__read_line.c +73 -0
- data/third_party/cares/cares/ares__timeval.c +111 -0
- data/third_party/cares/cares/ares_cancel.c +63 -0
- data/third_party/cares/cares/ares_create_query.c +202 -0
- data/third_party/cares/cares/ares_data.c +221 -0
- data/third_party/cares/cares/ares_data.h +72 -0
- data/third_party/cares/cares/ares_destroy.c +108 -0
- data/third_party/cares/cares/ares_dns.h +103 -0
- data/third_party/cares/cares/ares_expand_name.c +205 -0
- data/third_party/cares/cares/ares_expand_string.c +70 -0
- data/third_party/cares/cares/ares_fds.c +59 -0
- data/third_party/cares/cares/ares_free_hostent.c +41 -0
- data/third_party/cares/cares/ares_free_string.c +25 -0
- data/third_party/cares/cares/ares_getenv.c +30 -0
- data/third_party/cares/cares/ares_getenv.h +26 -0
- data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
- data/third_party/cares/cares/ares_gethostbyname.c +518 -0
- data/third_party/cares/cares/ares_getnameinfo.c +422 -0
- data/third_party/cares/cares/ares_getopt.c +122 -0
- data/third_party/cares/cares/ares_getopt.h +53 -0
- data/third_party/cares/cares/ares_getsock.c +66 -0
- data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
- data/third_party/cares/cares/ares_init.c +2146 -0
- data/third_party/cares/cares/ares_iphlpapi.h +221 -0
- data/third_party/cares/cares/ares_ipv6.h +78 -0
- data/third_party/cares/cares/ares_library_init.c +167 -0
- data/third_party/cares/cares/ares_library_init.h +42 -0
- data/third_party/cares/cares/ares_llist.c +63 -0
- data/third_party/cares/cares/ares_llist.h +39 -0
- data/third_party/cares/cares/ares_mkquery.c +24 -0
- data/third_party/cares/cares/ares_nowarn.c +260 -0
- data/third_party/cares/cares/ares_nowarn.h +61 -0
- data/third_party/cares/cares/ares_options.c +402 -0
- data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
- data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
- data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
- data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
- data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
- data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
- data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
- data/third_party/cares/cares/ares_platform.c +11035 -0
- data/third_party/cares/cares/ares_platform.h +43 -0
- data/third_party/cares/cares/ares_private.h +363 -0
- data/third_party/cares/cares/ares_process.c +1359 -0
- data/third_party/cares/cares/ares_query.c +186 -0
- data/third_party/cares/cares/ares_rules.h +125 -0
- data/third_party/cares/cares/ares_search.c +316 -0
- data/third_party/cares/cares/ares_send.c +131 -0
- data/third_party/cares/cares/ares_setup.h +217 -0
- data/third_party/cares/cares/ares_strcasecmp.c +66 -0
- data/third_party/cares/cares/ares_strcasecmp.h +30 -0
- data/third_party/cares/cares/ares_strdup.c +49 -0
- data/third_party/cares/cares/ares_strdup.h +24 -0
- data/third_party/cares/cares/ares_strerror.c +56 -0
- data/third_party/cares/cares/ares_timeout.c +88 -0
- data/third_party/cares/cares/ares_version.c +11 -0
- data/third_party/cares/cares/ares_version.h +24 -0
- data/third_party/cares/cares/ares_writev.c +79 -0
- data/third_party/cares/cares/bitncmp.c +59 -0
- data/third_party/cares/cares/bitncmp.h +26 -0
- data/third_party/cares/cares/config-win32.h +377 -0
- data/third_party/cares/cares/inet_net_pton.c +450 -0
- data/third_party/cares/cares/inet_ntop.c +208 -0
- data/third_party/cares/cares/setup_once.h +554 -0
- data/third_party/cares/cares/windows_port.c +22 -0
- data/third_party/cares/config_darwin/ares_config.h +523 -0
- data/third_party/cares/config_linux/ares_config.h +524 -0
- data/third_party/nanopb/pb.h +579 -0
- data/third_party/nanopb/pb_common.c +97 -0
- data/third_party/nanopb/pb_common.h +42 -0
- data/third_party/nanopb/pb_decode.c +1347 -0
- data/third_party/nanopb/pb_decode.h +149 -0
- data/third_party/nanopb/pb_encode.c +696 -0
- data/third_party/nanopb/pb_encode.h +154 -0
- data/third_party/zlib/adler32.c +179 -0
- data/third_party/zlib/compress.c +80 -0
- data/third_party/zlib/crc32.c +425 -0
- data/third_party/zlib/crc32.h +441 -0
- data/third_party/zlib/deflate.c +1967 -0
- data/third_party/zlib/deflate.h +346 -0
- data/third_party/zlib/gzclose.c +25 -0
- data/third_party/zlib/gzguts.h +209 -0
- data/third_party/zlib/gzlib.c +634 -0
- data/third_party/zlib/gzread.c +594 -0
- data/third_party/zlib/gzwrite.c +577 -0
- data/third_party/zlib/infback.c +640 -0
- data/third_party/zlib/inffast.c +340 -0
- data/third_party/zlib/inffast.h +11 -0
- data/third_party/zlib/inffixed.h +94 -0
- data/third_party/zlib/inflate.c +1512 -0
- data/third_party/zlib/inflate.h +122 -0
- data/third_party/zlib/inftrees.c +306 -0
- data/third_party/zlib/inftrees.h +62 -0
- data/third_party/zlib/trees.c +1226 -0
- data/third_party/zlib/trees.h +128 -0
- data/third_party/zlib/uncompr.c +59 -0
- data/third_party/zlib/zconf.h +511 -0
- data/third_party/zlib/zlib.h +1768 -0
- data/third_party/zlib/zutil.c +324 -0
- data/third_party/zlib/zutil.h +253 -0
- metadata +1397 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2016, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
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.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
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.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H
|
35
|
+
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H
|
36
|
+
|
37
|
+
void grpc_register_http_proxy_mapper();
|
38
|
+
|
39
|
+
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */
|
@@ -0,0 +1,1419 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2016, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
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.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
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.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
/** Implementation of the gRPC LB policy.
|
35
|
+
*
|
36
|
+
* This policy takes as input a set of resolved addresses {a1..an} for which the
|
37
|
+
* LB set was set (it's the resolver's responsibility to ensure this). That is
|
38
|
+
* to say, {a1..an} represent a collection of LB servers.
|
39
|
+
*
|
40
|
+
* An internal channel (\a glb_lb_policy.lb_channel) is created over {a1..an}.
|
41
|
+
* This channel behaves just like a regular channel. In particular, the
|
42
|
+
* constructed URI over the addresses a1..an will use the default pick first
|
43
|
+
* policy to select from this list of LB server backends.
|
44
|
+
*
|
45
|
+
* The first time the policy gets a request for a pick, a ping, or to exit the
|
46
|
+
* idle state, \a query_for_backends_locked() is called. This function sets up
|
47
|
+
* and initiates the internal communication with the LB server. In particular,
|
48
|
+
* it's responsible for instantiating the internal *streaming* call to the LB
|
49
|
+
* server (whichever address from {a1..an} pick-first chose). This call is
|
50
|
+
* serviced by two callbacks, \a lb_on_server_status_received and \a
|
51
|
+
* lb_on_response_received. The former will be called when the call to the LB
|
52
|
+
* server completes. This can happen if the LB server closes the connection or
|
53
|
+
* if this policy itself cancels the call (for example because it's shutting
|
54
|
+
* down). If the internal call times out, the usual behavior of pick-first
|
55
|
+
* applies, continuing to pick from the list {a1..an}.
|
56
|
+
*
|
57
|
+
* Upon sucesss, the incoming \a LoadBalancingResponse is processed by \a
|
58
|
+
* res_recv. An invalid one results in the termination of the streaming call. A
|
59
|
+
* new streaming call should be created if possible, failing the original call
|
60
|
+
* otherwise. For a valid \a LoadBalancingResponse, the server list of actual
|
61
|
+
* backends is extracted. A Round Robin policy will be created from this list.
|
62
|
+
* There are two possible scenarios:
|
63
|
+
*
|
64
|
+
* 1. This is the first server list received. There was no previous instance of
|
65
|
+
* the Round Robin policy. \a rr_handover_locked() will instantiate the RR
|
66
|
+
* policy and perform all the pending operations over it.
|
67
|
+
* 2. There's already a RR policy instance active. We need to introduce the new
|
68
|
+
* one build from the new serverlist, but taking care not to disrupt the
|
69
|
+
* operations in progress over the old RR instance. This is done by
|
70
|
+
* decreasing the reference count on the old policy. The moment no more
|
71
|
+
* references are held on the old RR policy, it'll be destroyed and \a
|
72
|
+
* glb_rr_connectivity_changed notified with a \a GRPC_CHANNEL_SHUTDOWN
|
73
|
+
* state. At this point we can transition to a new RR instance safely, which
|
74
|
+
* is done once again via \a rr_handover_locked().
|
75
|
+
*
|
76
|
+
*
|
77
|
+
* Once a RR policy instance is in place (and getting updated as described),
|
78
|
+
* calls to for a pick, a ping or a cancellation will be serviced right away by
|
79
|
+
* forwarding them to the RR instance. Any time there's no RR policy available
|
80
|
+
* (ie, right after the creation of the gRPCLB policy, if an empty serverlist is
|
81
|
+
* received, etc), pick/ping requests are added to a list of pending picks/pings
|
82
|
+
* to be flushed and serviced as part of \a rr_handover_locked() the moment the
|
83
|
+
* RR policy instance becomes available.
|
84
|
+
*
|
85
|
+
* \see https://github.com/grpc/grpc/blob/master/doc/load-balancing.md for the
|
86
|
+
* high level design and details. */
|
87
|
+
|
88
|
+
/* TODO(dgq):
|
89
|
+
* - Implement LB service forwarding (point 2c. in the doc's diagram).
|
90
|
+
*/
|
91
|
+
|
92
|
+
/* With the addition of a libuv endpoint, sockaddr.h now includes uv.h when
|
93
|
+
using that endpoint. Because of various transitive includes in uv.h,
|
94
|
+
including windows.h on Windows, uv.h must be included before other system
|
95
|
+
headers. Therefore, sockaddr.h must always be included first */
|
96
|
+
#include "src/core/lib/iomgr/sockaddr.h"
|
97
|
+
|
98
|
+
#include <errno.h>
|
99
|
+
|
100
|
+
#include <string.h>
|
101
|
+
|
102
|
+
#include <grpc/byte_buffer_reader.h>
|
103
|
+
#include <grpc/grpc.h>
|
104
|
+
#include <grpc/support/alloc.h>
|
105
|
+
#include <grpc/support/host_port.h>
|
106
|
+
#include <grpc/support/string_util.h>
|
107
|
+
#include <grpc/support/time.h>
|
108
|
+
|
109
|
+
#include "src/core/ext/filters/client_channel/client_channel.h"
|
110
|
+
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
|
111
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
|
112
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h"
|
113
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
|
114
|
+
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
115
|
+
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
116
|
+
#include "src/core/ext/filters/client_channel/parse_address.h"
|
117
|
+
#include "src/core/lib/channel/channel_args.h"
|
118
|
+
#include "src/core/lib/iomgr/combiner.h"
|
119
|
+
#include "src/core/lib/iomgr/sockaddr.h"
|
120
|
+
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
121
|
+
#include "src/core/lib/iomgr/timer.h"
|
122
|
+
#include "src/core/lib/slice/slice_hash_table.h"
|
123
|
+
#include "src/core/lib/slice/slice_internal.h"
|
124
|
+
#include "src/core/lib/slice/slice_string_helpers.h"
|
125
|
+
#include "src/core/lib/support/backoff.h"
|
126
|
+
#include "src/core/lib/support/string.h"
|
127
|
+
#include "src/core/lib/surface/call.h"
|
128
|
+
#include "src/core/lib/surface/channel.h"
|
129
|
+
#include "src/core/lib/transport/static_metadata.h"
|
130
|
+
|
131
|
+
#define GRPC_GRPCLB_MIN_CONNECT_TIMEOUT_SECONDS 20
|
132
|
+
#define GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS 1
|
133
|
+
#define GRPC_GRPCLB_RECONNECT_BACKOFF_MULTIPLIER 1.6
|
134
|
+
#define GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS 120
|
135
|
+
#define GRPC_GRPCLB_RECONNECT_JITTER 0.2
|
136
|
+
|
137
|
+
int grpc_lb_glb_trace = 0;
|
138
|
+
|
139
|
+
/* add lb_token of selected subchannel (address) to the call's initial
|
140
|
+
* metadata */
|
141
|
+
static grpc_error *initial_metadata_add_lb_token(
|
142
|
+
grpc_exec_ctx *exec_ctx, grpc_metadata_batch *initial_metadata,
|
143
|
+
grpc_linked_mdelem *lb_token_mdelem_storage, grpc_mdelem lb_token) {
|
144
|
+
GPR_ASSERT(lb_token_mdelem_storage != NULL);
|
145
|
+
GPR_ASSERT(!GRPC_MDISNULL(lb_token));
|
146
|
+
return grpc_metadata_batch_add_tail(exec_ctx, initial_metadata,
|
147
|
+
lb_token_mdelem_storage, lb_token);
|
148
|
+
}
|
149
|
+
|
150
|
+
typedef struct wrapped_rr_closure_arg {
|
151
|
+
/* the closure instance using this struct as argument */
|
152
|
+
grpc_closure wrapper_closure;
|
153
|
+
|
154
|
+
/* the original closure. Usually a on_complete/notify cb for pick() and ping()
|
155
|
+
* calls against the internal RR instance, respectively. */
|
156
|
+
grpc_closure *wrapped_closure;
|
157
|
+
|
158
|
+
/* the pick's initial metadata, kept in order to append the LB token for the
|
159
|
+
* pick */
|
160
|
+
grpc_metadata_batch *initial_metadata;
|
161
|
+
|
162
|
+
/* the picked target, used to determine which LB token to add to the pick's
|
163
|
+
* initial metadata */
|
164
|
+
grpc_connected_subchannel **target;
|
165
|
+
|
166
|
+
/* the LB token associated with the pick */
|
167
|
+
grpc_mdelem lb_token;
|
168
|
+
|
169
|
+
/* storage for the lb token initial metadata mdelem */
|
170
|
+
grpc_linked_mdelem *lb_token_mdelem_storage;
|
171
|
+
|
172
|
+
/* The RR instance related to the closure */
|
173
|
+
grpc_lb_policy *rr_policy;
|
174
|
+
|
175
|
+
/* heap memory to be freed upon closure execution. */
|
176
|
+
void *free_when_done;
|
177
|
+
} wrapped_rr_closure_arg;
|
178
|
+
|
179
|
+
/* The \a on_complete closure passed as part of the pick requires keeping a
|
180
|
+
* reference to its associated round robin instance. We wrap this closure in
|
181
|
+
* order to unref the round robin instance upon its invocation */
|
182
|
+
static void wrapped_rr_closure(grpc_exec_ctx *exec_ctx, void *arg,
|
183
|
+
grpc_error *error) {
|
184
|
+
wrapped_rr_closure_arg *wc_arg = arg;
|
185
|
+
|
186
|
+
GPR_ASSERT(wc_arg->wrapped_closure != NULL);
|
187
|
+
grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
|
188
|
+
|
189
|
+
if (wc_arg->rr_policy != NULL) {
|
190
|
+
/* if *target is NULL, no pick has been made by the RR policy (eg, all
|
191
|
+
* addresses failed to connect). There won't be any user_data/token
|
192
|
+
* available */
|
193
|
+
if (*wc_arg->target != NULL) {
|
194
|
+
if (!GRPC_MDISNULL(wc_arg->lb_token)) {
|
195
|
+
initial_metadata_add_lb_token(exec_ctx, wc_arg->initial_metadata,
|
196
|
+
wc_arg->lb_token_mdelem_storage,
|
197
|
+
GRPC_MDELEM_REF(wc_arg->lb_token));
|
198
|
+
} else {
|
199
|
+
gpr_log(GPR_ERROR,
|
200
|
+
"No LB token for connected subchannel pick %p (from RR "
|
201
|
+
"instance %p).",
|
202
|
+
(void *)*wc_arg->target, (void *)wc_arg->rr_policy);
|
203
|
+
abort();
|
204
|
+
}
|
205
|
+
}
|
206
|
+
if (grpc_lb_glb_trace) {
|
207
|
+
gpr_log(GPR_INFO, "Unreffing RR %p", (void *)wc_arg->rr_policy);
|
208
|
+
}
|
209
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "wrapped_rr_closure");
|
210
|
+
}
|
211
|
+
GPR_ASSERT(wc_arg->free_when_done != NULL);
|
212
|
+
gpr_free(wc_arg->free_when_done);
|
213
|
+
}
|
214
|
+
|
215
|
+
/* Linked list of pending pick requests. It stores all information needed to
|
216
|
+
* eventually call (Round Robin's) pick() on them. They mainly stay pending
|
217
|
+
* waiting for the RR policy to be created/updated.
|
218
|
+
*
|
219
|
+
* One particularity is the wrapping of the user-provided \a on_complete closure
|
220
|
+
* (in \a wrapped_on_complete and \a wrapped_on_complete_arg). This is needed in
|
221
|
+
* order to correctly unref the RR policy instance upon completion of the pick.
|
222
|
+
* See \a wrapped_rr_closure for details. */
|
223
|
+
typedef struct pending_pick {
|
224
|
+
struct pending_pick *next;
|
225
|
+
|
226
|
+
/* original pick()'s arguments */
|
227
|
+
grpc_lb_policy_pick_args pick_args;
|
228
|
+
|
229
|
+
/* output argument where to store the pick()ed connected subchannel, or NULL
|
230
|
+
* upon error. */
|
231
|
+
grpc_connected_subchannel **target;
|
232
|
+
|
233
|
+
/* args for wrapped_on_complete */
|
234
|
+
wrapped_rr_closure_arg wrapped_on_complete_arg;
|
235
|
+
} pending_pick;
|
236
|
+
|
237
|
+
static void add_pending_pick(pending_pick **root,
|
238
|
+
const grpc_lb_policy_pick_args *pick_args,
|
239
|
+
grpc_connected_subchannel **target,
|
240
|
+
grpc_closure *on_complete) {
|
241
|
+
pending_pick *pp = gpr_zalloc(sizeof(*pp));
|
242
|
+
pp->next = *root;
|
243
|
+
pp->pick_args = *pick_args;
|
244
|
+
pp->target = target;
|
245
|
+
pp->wrapped_on_complete_arg.wrapped_closure = on_complete;
|
246
|
+
pp->wrapped_on_complete_arg.target = target;
|
247
|
+
pp->wrapped_on_complete_arg.initial_metadata = pick_args->initial_metadata;
|
248
|
+
pp->wrapped_on_complete_arg.lb_token_mdelem_storage =
|
249
|
+
pick_args->lb_token_mdelem_storage;
|
250
|
+
pp->wrapped_on_complete_arg.free_when_done = pp;
|
251
|
+
grpc_closure_init(&pp->wrapped_on_complete_arg.wrapper_closure,
|
252
|
+
wrapped_rr_closure, &pp->wrapped_on_complete_arg,
|
253
|
+
grpc_schedule_on_exec_ctx);
|
254
|
+
*root = pp;
|
255
|
+
}
|
256
|
+
|
257
|
+
/* Same as the \a pending_pick struct but for ping operations */
|
258
|
+
typedef struct pending_ping {
|
259
|
+
struct pending_ping *next;
|
260
|
+
|
261
|
+
/* args for wrapped_notify */
|
262
|
+
wrapped_rr_closure_arg wrapped_notify_arg;
|
263
|
+
} pending_ping;
|
264
|
+
|
265
|
+
static void add_pending_ping(pending_ping **root, grpc_closure *notify) {
|
266
|
+
pending_ping *pping = gpr_zalloc(sizeof(*pping));
|
267
|
+
pping->wrapped_notify_arg.wrapped_closure = notify;
|
268
|
+
pping->wrapped_notify_arg.free_when_done = pping;
|
269
|
+
pping->next = *root;
|
270
|
+
grpc_closure_init(&pping->wrapped_notify_arg.wrapper_closure,
|
271
|
+
wrapped_rr_closure, &pping->wrapped_notify_arg,
|
272
|
+
grpc_schedule_on_exec_ctx);
|
273
|
+
*root = pping;
|
274
|
+
}
|
275
|
+
|
276
|
+
/*
|
277
|
+
* glb_lb_policy
|
278
|
+
*/
|
279
|
+
typedef struct rr_connectivity_data rr_connectivity_data;
|
280
|
+
static const grpc_lb_policy_vtable glb_lb_policy_vtable;
|
281
|
+
typedef struct glb_lb_policy {
|
282
|
+
/** base policy: must be first */
|
283
|
+
grpc_lb_policy base;
|
284
|
+
|
285
|
+
/** who the client is trying to communicate with */
|
286
|
+
const char *server_name;
|
287
|
+
grpc_client_channel_factory *cc_factory;
|
288
|
+
grpc_channel_args *args;
|
289
|
+
|
290
|
+
/** deadline for the LB's call */
|
291
|
+
gpr_timespec deadline;
|
292
|
+
|
293
|
+
/** for communicating with the LB server */
|
294
|
+
grpc_channel *lb_channel;
|
295
|
+
|
296
|
+
/** the RR policy to use of the backend servers returned by the LB server */
|
297
|
+
grpc_lb_policy *rr_policy;
|
298
|
+
|
299
|
+
bool started_picking;
|
300
|
+
|
301
|
+
/** our connectivity state tracker */
|
302
|
+
grpc_connectivity_state_tracker state_tracker;
|
303
|
+
|
304
|
+
/** stores the deserialized response from the LB. May be NULL until one such
|
305
|
+
* response has arrived. */
|
306
|
+
grpc_grpclb_serverlist *serverlist;
|
307
|
+
|
308
|
+
/** list of picks that are waiting on RR's policy connectivity */
|
309
|
+
pending_pick *pending_picks;
|
310
|
+
|
311
|
+
/** list of pings that are waiting on RR's policy connectivity */
|
312
|
+
pending_ping *pending_pings;
|
313
|
+
|
314
|
+
bool shutting_down;
|
315
|
+
|
316
|
+
/************************************************************/
|
317
|
+
/* client data associated with the LB server communication */
|
318
|
+
/************************************************************/
|
319
|
+
/* Status from the LB server has been received. This signals the end of the LB
|
320
|
+
* call. */
|
321
|
+
grpc_closure lb_on_server_status_received;
|
322
|
+
|
323
|
+
/* A response from the LB server has been received. Process it */
|
324
|
+
grpc_closure lb_on_response_received;
|
325
|
+
|
326
|
+
/* LB call retry timer callback. */
|
327
|
+
grpc_closure lb_on_call_retry;
|
328
|
+
|
329
|
+
grpc_call *lb_call; /* streaming call to the LB server, */
|
330
|
+
|
331
|
+
grpc_metadata_array lb_initial_metadata_recv; /* initial MD from LB server */
|
332
|
+
grpc_metadata_array
|
333
|
+
lb_trailing_metadata_recv; /* trailing MD from LB server */
|
334
|
+
|
335
|
+
/* what's being sent to the LB server. Note that its value may vary if the LB
|
336
|
+
* server indicates a redirect. */
|
337
|
+
grpc_byte_buffer *lb_request_payload;
|
338
|
+
|
339
|
+
/* response the LB server, if any. Processed in lb_on_response_received() */
|
340
|
+
grpc_byte_buffer *lb_response_payload;
|
341
|
+
|
342
|
+
/* call status code and details, set in lb_on_server_status_received() */
|
343
|
+
grpc_status_code lb_call_status;
|
344
|
+
grpc_slice lb_call_status_details;
|
345
|
+
|
346
|
+
/** LB call retry backoff state */
|
347
|
+
gpr_backoff lb_call_backoff_state;
|
348
|
+
|
349
|
+
/** LB call retry timer */
|
350
|
+
grpc_timer lb_call_retry_timer;
|
351
|
+
} glb_lb_policy;
|
352
|
+
|
353
|
+
/* Keeps track and reacts to changes in connectivity of the RR instance */
|
354
|
+
struct rr_connectivity_data {
|
355
|
+
grpc_closure on_change;
|
356
|
+
grpc_connectivity_state state;
|
357
|
+
glb_lb_policy *glb_policy;
|
358
|
+
};
|
359
|
+
|
360
|
+
static bool is_server_valid(const grpc_grpclb_server *server, size_t idx,
|
361
|
+
bool log) {
|
362
|
+
const grpc_grpclb_ip_address *ip = &server->ip_address;
|
363
|
+
if (server->port >> 16 != 0) {
|
364
|
+
if (log) {
|
365
|
+
gpr_log(GPR_ERROR,
|
366
|
+
"Invalid port '%d' at index %lu of serverlist. Ignoring.",
|
367
|
+
server->port, (unsigned long)idx);
|
368
|
+
}
|
369
|
+
return false;
|
370
|
+
}
|
371
|
+
|
372
|
+
if (ip->size != 4 && ip->size != 16) {
|
373
|
+
if (log) {
|
374
|
+
gpr_log(GPR_ERROR,
|
375
|
+
"Expected IP to be 4 or 16 bytes, got %d at index %lu of "
|
376
|
+
"serverlist. Ignoring",
|
377
|
+
ip->size, (unsigned long)idx);
|
378
|
+
}
|
379
|
+
return false;
|
380
|
+
}
|
381
|
+
return true;
|
382
|
+
}
|
383
|
+
|
384
|
+
/* vtable for LB tokens in grpc_lb_addresses. */
|
385
|
+
static void *lb_token_copy(void *token) {
|
386
|
+
return token == NULL
|
387
|
+
? NULL
|
388
|
+
: (void *)GRPC_MDELEM_REF((grpc_mdelem){(uintptr_t)token}).payload;
|
389
|
+
}
|
390
|
+
static void lb_token_destroy(grpc_exec_ctx *exec_ctx, void *token) {
|
391
|
+
if (token != NULL) {
|
392
|
+
GRPC_MDELEM_UNREF(exec_ctx, (grpc_mdelem){(uintptr_t)token});
|
393
|
+
}
|
394
|
+
}
|
395
|
+
static int lb_token_cmp(void *token1, void *token2) {
|
396
|
+
if (token1 > token2) return 1;
|
397
|
+
if (token1 < token2) return -1;
|
398
|
+
return 0;
|
399
|
+
}
|
400
|
+
static const grpc_lb_user_data_vtable lb_token_vtable = {
|
401
|
+
lb_token_copy, lb_token_destroy, lb_token_cmp};
|
402
|
+
|
403
|
+
static void parse_server(const grpc_grpclb_server *server,
|
404
|
+
grpc_resolved_address *addr) {
|
405
|
+
const uint16_t netorder_port = htons((uint16_t)server->port);
|
406
|
+
/* the addresses are given in binary format (a in(6)_addr struct) in
|
407
|
+
* server->ip_address.bytes. */
|
408
|
+
const grpc_grpclb_ip_address *ip = &server->ip_address;
|
409
|
+
memset(addr, 0, sizeof(*addr));
|
410
|
+
if (ip->size == 4) {
|
411
|
+
addr->len = sizeof(struct sockaddr_in);
|
412
|
+
struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr->addr;
|
413
|
+
addr4->sin_family = AF_INET;
|
414
|
+
memcpy(&addr4->sin_addr, ip->bytes, ip->size);
|
415
|
+
addr4->sin_port = netorder_port;
|
416
|
+
} else if (ip->size == 16) {
|
417
|
+
addr->len = sizeof(struct sockaddr_in6);
|
418
|
+
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr->addr;
|
419
|
+
addr6->sin6_family = AF_INET6;
|
420
|
+
memcpy(&addr6->sin6_addr, ip->bytes, ip->size);
|
421
|
+
addr6->sin6_port = netorder_port;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
/* Returns addresses extracted from \a serverlist. */
|
426
|
+
static grpc_lb_addresses *process_serverlist_locked(
|
427
|
+
grpc_exec_ctx *exec_ctx, const grpc_grpclb_serverlist *serverlist) {
|
428
|
+
size_t num_valid = 0;
|
429
|
+
/* first pass: count how many are valid in order to allocate the necessary
|
430
|
+
* memory in a single block */
|
431
|
+
for (size_t i = 0; i < serverlist->num_servers; ++i) {
|
432
|
+
if (is_server_valid(serverlist->servers[i], i, true)) ++num_valid;
|
433
|
+
}
|
434
|
+
if (num_valid == 0) return NULL;
|
435
|
+
|
436
|
+
grpc_lb_addresses *lb_addresses =
|
437
|
+
grpc_lb_addresses_create(num_valid, &lb_token_vtable);
|
438
|
+
|
439
|
+
/* second pass: actually populate the addresses and LB tokens (aka user data
|
440
|
+
* to the outside world) to be read by the RR policy during its creation.
|
441
|
+
* Given that the validity tests are very cheap, they are performed again
|
442
|
+
* instead of marking the valid ones during the first pass, as this would
|
443
|
+
* incurr in an allocation due to the arbitrary number of server */
|
444
|
+
size_t addr_idx = 0;
|
445
|
+
for (size_t sl_idx = 0; sl_idx < serverlist->num_servers; ++sl_idx) {
|
446
|
+
GPR_ASSERT(addr_idx < num_valid);
|
447
|
+
const grpc_grpclb_server *server = serverlist->servers[sl_idx];
|
448
|
+
if (!is_server_valid(serverlist->servers[sl_idx], sl_idx, false)) continue;
|
449
|
+
|
450
|
+
/* address processing */
|
451
|
+
grpc_resolved_address addr;
|
452
|
+
parse_server(server, &addr);
|
453
|
+
|
454
|
+
/* lb token processing */
|
455
|
+
void *user_data;
|
456
|
+
if (server->has_load_balance_token) {
|
457
|
+
const size_t lb_token_max_length =
|
458
|
+
GPR_ARRAY_SIZE(server->load_balance_token);
|
459
|
+
const size_t lb_token_length =
|
460
|
+
strnlen(server->load_balance_token, lb_token_max_length);
|
461
|
+
grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer(
|
462
|
+
server->load_balance_token, lb_token_length);
|
463
|
+
user_data = (void *)grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_LB_TOKEN,
|
464
|
+
lb_token_mdstr)
|
465
|
+
.payload;
|
466
|
+
} else {
|
467
|
+
char *uri = grpc_sockaddr_to_uri(&addr);
|
468
|
+
gpr_log(GPR_INFO,
|
469
|
+
"Missing LB token for backend address '%s'. The empty token will "
|
470
|
+
"be used instead",
|
471
|
+
uri);
|
472
|
+
gpr_free(uri);
|
473
|
+
user_data = (void *)GRPC_MDELEM_LB_TOKEN_EMPTY.payload;
|
474
|
+
}
|
475
|
+
|
476
|
+
grpc_lb_addresses_set_address(lb_addresses, addr_idx, &addr.addr, addr.len,
|
477
|
+
false /* is_balancer */,
|
478
|
+
NULL /* balancer_name */, user_data);
|
479
|
+
++addr_idx;
|
480
|
+
}
|
481
|
+
GPR_ASSERT(addr_idx == num_valid);
|
482
|
+
return lb_addresses;
|
483
|
+
}
|
484
|
+
|
485
|
+
/* returns true if the new RR policy should replace the current one, if any */
|
486
|
+
static bool update_lb_connectivity_status_locked(
|
487
|
+
grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy,
|
488
|
+
grpc_connectivity_state new_rr_state, grpc_error *new_rr_state_error) {
|
489
|
+
const grpc_connectivity_state curr_glb_state =
|
490
|
+
grpc_connectivity_state_check(&glb_policy->state_tracker);
|
491
|
+
|
492
|
+
/* The new connectivity status is a function of the previous one and the new
|
493
|
+
* input coming from the status of the RR policy.
|
494
|
+
*
|
495
|
+
* current state (grpclb's)
|
496
|
+
* |
|
497
|
+
* v || I | C | R | TF | SD | <- new state (RR's)
|
498
|
+
* ===++====+=====+=====+======+======+
|
499
|
+
* I || I | C | R | [I] | [I] |
|
500
|
+
* ---++----+-----+-----+------+------+
|
501
|
+
* C || I | C | R | [C] | [C] |
|
502
|
+
* ---++----+-----+-----+------+------+
|
503
|
+
* R || I | C | R | [R] | [R] |
|
504
|
+
* ---++----+-----+-----+------+------+
|
505
|
+
* TF || I | C | R | [TF] | [TF] |
|
506
|
+
* ---++----+-----+-----+------+------+
|
507
|
+
* SD || NA | NA | NA | NA | NA | (*)
|
508
|
+
* ---++----+-----+-----+------+------+
|
509
|
+
*
|
510
|
+
* A [STATE] indicates that the old RR policy is kept. In those cases, STATE
|
511
|
+
* is the current state of grpclb, which is left untouched.
|
512
|
+
*
|
513
|
+
* In summary, if the new state is TRANSIENT_FAILURE or SHUTDOWN, stick to
|
514
|
+
* the previous RR instance.
|
515
|
+
*
|
516
|
+
* Note that the status is never updated to SHUTDOWN as a result of calling
|
517
|
+
* this function. Only glb_shutdown() has the power to set that state.
|
518
|
+
*
|
519
|
+
* (*) This function mustn't be called during shutting down. */
|
520
|
+
GPR_ASSERT(curr_glb_state != GRPC_CHANNEL_SHUTDOWN);
|
521
|
+
|
522
|
+
switch (new_rr_state) {
|
523
|
+
case GRPC_CHANNEL_TRANSIENT_FAILURE:
|
524
|
+
case GRPC_CHANNEL_SHUTDOWN:
|
525
|
+
GPR_ASSERT(new_rr_state_error != GRPC_ERROR_NONE);
|
526
|
+
return false; /* don't replace the RR policy */
|
527
|
+
case GRPC_CHANNEL_INIT:
|
528
|
+
case GRPC_CHANNEL_IDLE:
|
529
|
+
case GRPC_CHANNEL_CONNECTING:
|
530
|
+
case GRPC_CHANNEL_READY:
|
531
|
+
GPR_ASSERT(new_rr_state_error == GRPC_ERROR_NONE);
|
532
|
+
}
|
533
|
+
|
534
|
+
if (grpc_lb_glb_trace) {
|
535
|
+
gpr_log(GPR_INFO,
|
536
|
+
"Setting grpclb's state to %s from new RR policy %p state.",
|
537
|
+
grpc_connectivity_state_name(new_rr_state),
|
538
|
+
(void *)glb_policy->rr_policy);
|
539
|
+
}
|
540
|
+
grpc_connectivity_state_set(exec_ctx, &glb_policy->state_tracker,
|
541
|
+
new_rr_state, GRPC_ERROR_REF(new_rr_state_error),
|
542
|
+
"update_lb_connectivity_status_locked");
|
543
|
+
return true;
|
544
|
+
}
|
545
|
+
|
546
|
+
/* perform a pick over \a rr_policy. Given that a pick can return immediately
|
547
|
+
* (ignoring its completion callback) we need to perform the cleanups this
|
548
|
+
* callback would be otherwise resposible for */
|
549
|
+
static bool pick_from_internal_rr_locked(
|
550
|
+
grpc_exec_ctx *exec_ctx, grpc_lb_policy *rr_policy,
|
551
|
+
const grpc_lb_policy_pick_args *pick_args,
|
552
|
+
grpc_connected_subchannel **target, wrapped_rr_closure_arg *wc_arg) {
|
553
|
+
GPR_ASSERT(rr_policy != NULL);
|
554
|
+
const bool pick_done = grpc_lb_policy_pick_locked(
|
555
|
+
exec_ctx, rr_policy, pick_args, target, (void **)&wc_arg->lb_token,
|
556
|
+
&wc_arg->wrapper_closure);
|
557
|
+
if (pick_done) {
|
558
|
+
/* synchronous grpc_lb_policy_pick call. Unref the RR policy. */
|
559
|
+
if (grpc_lb_glb_trace) {
|
560
|
+
gpr_log(GPR_INFO, "Unreffing RR (0x%" PRIxPTR ")",
|
561
|
+
(intptr_t)wc_arg->rr_policy);
|
562
|
+
}
|
563
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "glb_pick_sync");
|
564
|
+
|
565
|
+
/* add the load reporting initial metadata */
|
566
|
+
initial_metadata_add_lb_token(exec_ctx, pick_args->initial_metadata,
|
567
|
+
pick_args->lb_token_mdelem_storage,
|
568
|
+
GRPC_MDELEM_REF(wc_arg->lb_token));
|
569
|
+
|
570
|
+
gpr_free(wc_arg);
|
571
|
+
}
|
572
|
+
/* else, the pending pick will be registered and taken care of by the
|
573
|
+
* pending pick list inside the RR policy (glb_policy->rr_policy).
|
574
|
+
* Eventually, wrapped_on_complete will be called, which will -among other
|
575
|
+
* things- add the LB token to the call's initial metadata */
|
576
|
+
return pick_done;
|
577
|
+
}
|
578
|
+
|
579
|
+
static grpc_lb_policy *create_rr_locked(
|
580
|
+
grpc_exec_ctx *exec_ctx, const grpc_grpclb_serverlist *serverlist,
|
581
|
+
glb_lb_policy *glb_policy) {
|
582
|
+
GPR_ASSERT(serverlist != NULL && serverlist->num_servers > 0);
|
583
|
+
|
584
|
+
grpc_lb_policy_args args;
|
585
|
+
memset(&args, 0, sizeof(args));
|
586
|
+
args.client_channel_factory = glb_policy->cc_factory;
|
587
|
+
args.combiner = glb_policy->base.combiner;
|
588
|
+
grpc_lb_addresses *addresses =
|
589
|
+
process_serverlist_locked(exec_ctx, serverlist);
|
590
|
+
|
591
|
+
// Replace the LB addresses in the channel args that we pass down to
|
592
|
+
// the subchannel.
|
593
|
+
static const char *keys_to_remove[] = {GRPC_ARG_LB_ADDRESSES};
|
594
|
+
const grpc_arg arg = grpc_lb_addresses_create_channel_arg(addresses);
|
595
|
+
args.args = grpc_channel_args_copy_and_add_and_remove(
|
596
|
+
glb_policy->args, keys_to_remove, GPR_ARRAY_SIZE(keys_to_remove), &arg,
|
597
|
+
1);
|
598
|
+
|
599
|
+
grpc_lb_policy *rr = grpc_lb_policy_create(exec_ctx, "round_robin", &args);
|
600
|
+
GPR_ASSERT(rr != NULL);
|
601
|
+
grpc_lb_addresses_destroy(exec_ctx, addresses);
|
602
|
+
grpc_channel_args_destroy(exec_ctx, args.args);
|
603
|
+
return rr;
|
604
|
+
}
|
605
|
+
|
606
|
+
static void glb_rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx,
|
607
|
+
void *arg, grpc_error *error);
|
608
|
+
/* glb_policy->rr_policy may be NULL (initial handover) */
|
609
|
+
static void rr_handover_locked(grpc_exec_ctx *exec_ctx,
|
610
|
+
glb_lb_policy *glb_policy) {
|
611
|
+
GPR_ASSERT(glb_policy->serverlist != NULL &&
|
612
|
+
glb_policy->serverlist->num_servers > 0);
|
613
|
+
|
614
|
+
if (glb_policy->shutting_down) return;
|
615
|
+
|
616
|
+
grpc_lb_policy *new_rr_policy =
|
617
|
+
create_rr_locked(exec_ctx, glb_policy->serverlist, glb_policy);
|
618
|
+
if (new_rr_policy == NULL) {
|
619
|
+
gpr_log(GPR_ERROR,
|
620
|
+
"Failure creating a RoundRobin policy for serverlist update with "
|
621
|
+
"%lu entries. The previous RR instance (%p), if any, will continue "
|
622
|
+
"to be used. Future updates from the LB will attempt to create new "
|
623
|
+
"instances.",
|
624
|
+
(unsigned long)glb_policy->serverlist->num_servers,
|
625
|
+
(void *)glb_policy->rr_policy);
|
626
|
+
return;
|
627
|
+
}
|
628
|
+
|
629
|
+
grpc_error *new_rr_state_error = NULL;
|
630
|
+
const grpc_connectivity_state new_rr_state =
|
631
|
+
grpc_lb_policy_check_connectivity_locked(exec_ctx, new_rr_policy,
|
632
|
+
&new_rr_state_error);
|
633
|
+
/* Connectivity state is a function of the new RR policy just created */
|
634
|
+
const bool replace_old_rr = update_lb_connectivity_status_locked(
|
635
|
+
exec_ctx, glb_policy, new_rr_state, new_rr_state_error);
|
636
|
+
|
637
|
+
if (!replace_old_rr) {
|
638
|
+
/* dispose of the new RR policy that won't be used after all */
|
639
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, new_rr_policy, "rr_handover_no_replace");
|
640
|
+
if (grpc_lb_glb_trace) {
|
641
|
+
gpr_log(GPR_INFO,
|
642
|
+
"Keeping old RR policy (%p) despite new serverlist: new RR "
|
643
|
+
"policy was in %s connectivity state.",
|
644
|
+
(void *)glb_policy->rr_policy,
|
645
|
+
grpc_connectivity_state_name(new_rr_state));
|
646
|
+
}
|
647
|
+
return;
|
648
|
+
}
|
649
|
+
|
650
|
+
if (grpc_lb_glb_trace) {
|
651
|
+
gpr_log(GPR_INFO, "Created RR policy (%p) to replace old RR (%p)",
|
652
|
+
(void *)new_rr_policy, (void *)glb_policy->rr_policy);
|
653
|
+
}
|
654
|
+
|
655
|
+
if (glb_policy->rr_policy != NULL) {
|
656
|
+
/* if we are phasing out an existing RR instance, unref it. */
|
657
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "rr_handover");
|
658
|
+
}
|
659
|
+
|
660
|
+
/* Finally update the RR policy to the newly created one */
|
661
|
+
glb_policy->rr_policy = new_rr_policy;
|
662
|
+
|
663
|
+
/* Add the gRPC LB's interested_parties pollset_set to that of the newly
|
664
|
+
* created RR policy. This will make the RR policy progress upon activity on
|
665
|
+
* gRPC LB, which in turn is tied to the application's call */
|
666
|
+
grpc_pollset_set_add_pollset_set(exec_ctx,
|
667
|
+
glb_policy->rr_policy->interested_parties,
|
668
|
+
glb_policy->base.interested_parties);
|
669
|
+
|
670
|
+
/* Allocate the data for the tracking of the new RR policy's connectivity.
|
671
|
+
* It'll be deallocated in glb_rr_connectivity_changed() */
|
672
|
+
rr_connectivity_data *rr_connectivity =
|
673
|
+
gpr_zalloc(sizeof(rr_connectivity_data));
|
674
|
+
grpc_closure_init(&rr_connectivity->on_change,
|
675
|
+
glb_rr_connectivity_changed_locked, rr_connectivity,
|
676
|
+
grpc_combiner_scheduler(glb_policy->base.combiner, false));
|
677
|
+
rr_connectivity->glb_policy = glb_policy;
|
678
|
+
rr_connectivity->state = new_rr_state;
|
679
|
+
|
680
|
+
/* Subscribe to changes to the connectivity of the new RR */
|
681
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "rr_connectivity_cb");
|
682
|
+
grpc_lb_policy_notify_on_state_change_locked(exec_ctx, glb_policy->rr_policy,
|
683
|
+
&rr_connectivity->state,
|
684
|
+
&rr_connectivity->on_change);
|
685
|
+
grpc_lb_policy_exit_idle_locked(exec_ctx, glb_policy->rr_policy);
|
686
|
+
|
687
|
+
/* Update picks and pings in wait */
|
688
|
+
pending_pick *pp;
|
689
|
+
while ((pp = glb_policy->pending_picks)) {
|
690
|
+
glb_policy->pending_picks = pp->next;
|
691
|
+
GRPC_LB_POLICY_REF(glb_policy->rr_policy, "rr_handover_pending_pick");
|
692
|
+
pp->wrapped_on_complete_arg.rr_policy = glb_policy->rr_policy;
|
693
|
+
if (grpc_lb_glb_trace) {
|
694
|
+
gpr_log(GPR_INFO, "Pending pick about to PICK from 0x%" PRIxPTR "",
|
695
|
+
(intptr_t)glb_policy->rr_policy);
|
696
|
+
}
|
697
|
+
pick_from_internal_rr_locked(exec_ctx, glb_policy->rr_policy,
|
698
|
+
&pp->pick_args, pp->target,
|
699
|
+
&pp->wrapped_on_complete_arg);
|
700
|
+
}
|
701
|
+
|
702
|
+
pending_ping *pping;
|
703
|
+
while ((pping = glb_policy->pending_pings)) {
|
704
|
+
glb_policy->pending_pings = pping->next;
|
705
|
+
GRPC_LB_POLICY_REF(glb_policy->rr_policy, "rr_handover_pending_ping");
|
706
|
+
pping->wrapped_notify_arg.rr_policy = glb_policy->rr_policy;
|
707
|
+
if (grpc_lb_glb_trace) {
|
708
|
+
gpr_log(GPR_INFO, "Pending ping about to PING from 0x%" PRIxPTR "",
|
709
|
+
(intptr_t)glb_policy->rr_policy);
|
710
|
+
}
|
711
|
+
grpc_lb_policy_ping_one_locked(exec_ctx, glb_policy->rr_policy,
|
712
|
+
&pping->wrapped_notify_arg.wrapper_closure);
|
713
|
+
}
|
714
|
+
}
|
715
|
+
|
716
|
+
static void glb_rr_connectivity_changed_locked(grpc_exec_ctx *exec_ctx,
|
717
|
+
void *arg, grpc_error *error) {
|
718
|
+
rr_connectivity_data *rr_connectivity = arg;
|
719
|
+
glb_lb_policy *glb_policy = rr_connectivity->glb_policy;
|
720
|
+
|
721
|
+
const bool shutting_down = glb_policy->shutting_down;
|
722
|
+
bool unref_needed = false;
|
723
|
+
GRPC_ERROR_REF(error);
|
724
|
+
|
725
|
+
if (rr_connectivity->state == GRPC_CHANNEL_SHUTDOWN || shutting_down) {
|
726
|
+
/* RR policy shutting down. Don't renew subscription and free the arg of
|
727
|
+
* this callback. In addition we need to stash away the current policy to
|
728
|
+
* be UNREF'd after releasing the lock. Otherwise, if the UNREF is the last
|
729
|
+
* one, the policy would be destroyed, alongside the lock, which would
|
730
|
+
* result in a use-after-free */
|
731
|
+
unref_needed = true;
|
732
|
+
gpr_free(rr_connectivity);
|
733
|
+
} else { /* rr state != SHUTDOWN && !shutting down: biz as usual */
|
734
|
+
update_lb_connectivity_status_locked(exec_ctx, glb_policy,
|
735
|
+
rr_connectivity->state, error);
|
736
|
+
/* Resubscribe. Reuse the "rr_connectivity_cb" weak ref. */
|
737
|
+
grpc_lb_policy_notify_on_state_change_locked(
|
738
|
+
exec_ctx, glb_policy->rr_policy, &rr_connectivity->state,
|
739
|
+
&rr_connectivity->on_change);
|
740
|
+
}
|
741
|
+
if (unref_needed) {
|
742
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
743
|
+
"rr_connectivity_cb");
|
744
|
+
}
|
745
|
+
GRPC_ERROR_UNREF(error);
|
746
|
+
}
|
747
|
+
|
748
|
+
static void destroy_balancer_name(grpc_exec_ctx *exec_ctx,
|
749
|
+
void *balancer_name) {
|
750
|
+
gpr_free(balancer_name);
|
751
|
+
}
|
752
|
+
|
753
|
+
static void *copy_balancer_name(void *balancer_name) {
|
754
|
+
return gpr_strdup(balancer_name);
|
755
|
+
}
|
756
|
+
|
757
|
+
static grpc_slice_hash_table_entry targets_info_entry_create(
|
758
|
+
const char *address, const char *balancer_name) {
|
759
|
+
static const grpc_slice_hash_table_vtable vtable = {destroy_balancer_name,
|
760
|
+
copy_balancer_name};
|
761
|
+
grpc_slice_hash_table_entry entry;
|
762
|
+
entry.key = grpc_slice_from_copied_string(address);
|
763
|
+
entry.value = (void *)balancer_name;
|
764
|
+
entry.vtable = &vtable;
|
765
|
+
return entry;
|
766
|
+
}
|
767
|
+
|
768
|
+
/* Returns the target URI for the LB service whose addresses are in \a
|
769
|
+
* addresses. Using this URI, a bidirectional streaming channel will be created
|
770
|
+
* for the reception of load balancing updates.
|
771
|
+
*
|
772
|
+
* The output argument \a targets_info will be updated to contain a mapping of
|
773
|
+
* "LB server address" to "balancer name", as reported by the naming system.
|
774
|
+
* This mapping will be propagated via the channel arguments of the
|
775
|
+
* aforementioned LB streaming channel, to be used by the security connector for
|
776
|
+
* secure naming checks. The user is responsible for freeing \a targets_info. */
|
777
|
+
static char *get_lb_uri_target_addresses(grpc_exec_ctx *exec_ctx,
|
778
|
+
const grpc_lb_addresses *addresses,
|
779
|
+
grpc_slice_hash_table **targets_info) {
|
780
|
+
size_t num_grpclb_addrs = 0;
|
781
|
+
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
782
|
+
if (addresses->addresses[i].is_balancer) ++num_grpclb_addrs;
|
783
|
+
}
|
784
|
+
/* All input addresses come from a resolver that claims they are LB services.
|
785
|
+
* It's the resolver's responsibility to make sure this policy is only
|
786
|
+
* instantiated and used in that case. Otherwise, something has gone wrong. */
|
787
|
+
GPR_ASSERT(num_grpclb_addrs > 0);
|
788
|
+
|
789
|
+
grpc_slice_hash_table_entry *targets_info_entries =
|
790
|
+
gpr_malloc(sizeof(*targets_info_entries) * num_grpclb_addrs);
|
791
|
+
|
792
|
+
/* construct a target ipvX://ip1:port1,ip2:port2,... from the addresses in \a
|
793
|
+
* addresses */
|
794
|
+
/* TODO(dgq): support mixed ip version */
|
795
|
+
char **addr_strs = gpr_malloc(sizeof(char *) * num_grpclb_addrs);
|
796
|
+
size_t addr_index = 0;
|
797
|
+
|
798
|
+
for (size_t i = 0; i < addresses->num_addresses; i++) {
|
799
|
+
if (addresses->addresses[i].user_data != NULL) {
|
800
|
+
gpr_log(GPR_ERROR,
|
801
|
+
"This LB policy doesn't support user data. It will be ignored");
|
802
|
+
}
|
803
|
+
if (addresses->addresses[i].is_balancer) {
|
804
|
+
char *addr_str;
|
805
|
+
GPR_ASSERT(grpc_sockaddr_to_string(
|
806
|
+
&addr_str, &addresses->addresses[i].address, true) > 0);
|
807
|
+
targets_info_entries[addr_index] = targets_info_entry_create(
|
808
|
+
addr_str, addresses->addresses[i].balancer_name);
|
809
|
+
addr_strs[addr_index++] = addr_str;
|
810
|
+
}
|
811
|
+
}
|
812
|
+
GPR_ASSERT(addr_index == num_grpclb_addrs);
|
813
|
+
|
814
|
+
size_t uri_path_len;
|
815
|
+
char *uri_path = gpr_strjoin_sep((const char **)addr_strs, num_grpclb_addrs,
|
816
|
+
",", &uri_path_len);
|
817
|
+
for (size_t i = 0; i < num_grpclb_addrs; i++) gpr_free(addr_strs[i]);
|
818
|
+
gpr_free(addr_strs);
|
819
|
+
|
820
|
+
char *target_uri_str = NULL;
|
821
|
+
/* TODO(dgq): Don't assume all addresses will share the scheme of the first
|
822
|
+
* one */
|
823
|
+
gpr_asprintf(&target_uri_str, "%s:%s",
|
824
|
+
grpc_sockaddr_get_uri_scheme(&addresses->addresses[0].address),
|
825
|
+
uri_path);
|
826
|
+
gpr_free(uri_path);
|
827
|
+
|
828
|
+
*targets_info =
|
829
|
+
grpc_slice_hash_table_create(num_grpclb_addrs, targets_info_entries);
|
830
|
+
for (size_t i = 0; i < num_grpclb_addrs; i++) {
|
831
|
+
grpc_slice_unref_internal(exec_ctx, targets_info_entries[i].key);
|
832
|
+
}
|
833
|
+
gpr_free(targets_info_entries);
|
834
|
+
|
835
|
+
return target_uri_str;
|
836
|
+
}
|
837
|
+
|
838
|
+
static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
|
839
|
+
grpc_lb_policy_factory *factory,
|
840
|
+
grpc_lb_policy_args *args) {
|
841
|
+
/* Count the number of gRPC-LB addresses. There must be at least one.
|
842
|
+
* TODO(roth): For now, we ignore non-balancer addresses, but in the
|
843
|
+
* future, we may change the behavior such that we fall back to using
|
844
|
+
* the non-balancer addresses if we cannot reach any balancers. At that
|
845
|
+
* time, this should be changed to allow a list with no balancer addresses,
|
846
|
+
* since the resolver might fail to return a balancer address even when
|
847
|
+
* this is the right LB policy to use. */
|
848
|
+
const grpc_arg *arg =
|
849
|
+
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
|
850
|
+
if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
|
851
|
+
return NULL;
|
852
|
+
}
|
853
|
+
grpc_lb_addresses *addresses = arg->value.pointer.p;
|
854
|
+
size_t num_grpclb_addrs = 0;
|
855
|
+
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
856
|
+
if (addresses->addresses[i].is_balancer) ++num_grpclb_addrs;
|
857
|
+
}
|
858
|
+
if (num_grpclb_addrs == 0) return NULL;
|
859
|
+
|
860
|
+
glb_lb_policy *glb_policy = gpr_zalloc(sizeof(*glb_policy));
|
861
|
+
|
862
|
+
/* Get server name. */
|
863
|
+
arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI);
|
864
|
+
GPR_ASSERT(arg != NULL);
|
865
|
+
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
|
866
|
+
grpc_uri *uri = grpc_uri_parse(exec_ctx, arg->value.string, true);
|
867
|
+
GPR_ASSERT(uri->path[0] != '\0');
|
868
|
+
glb_policy->server_name =
|
869
|
+
gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path);
|
870
|
+
if (grpc_lb_glb_trace) {
|
871
|
+
gpr_log(GPR_INFO, "Will use '%s' as the server name for LB request.",
|
872
|
+
glb_policy->server_name);
|
873
|
+
}
|
874
|
+
grpc_uri_destroy(uri);
|
875
|
+
|
876
|
+
glb_policy->cc_factory = args->client_channel_factory;
|
877
|
+
glb_policy->args = grpc_channel_args_copy(args->args);
|
878
|
+
GPR_ASSERT(glb_policy->cc_factory != NULL);
|
879
|
+
|
880
|
+
grpc_slice_hash_table *targets_info = NULL;
|
881
|
+
/* Create a client channel over them to communicate with a LB service */
|
882
|
+
char *lb_service_target_addresses =
|
883
|
+
get_lb_uri_target_addresses(exec_ctx, addresses, &targets_info);
|
884
|
+
grpc_channel_args *lb_channel_args =
|
885
|
+
get_lb_channel_args(exec_ctx, targets_info, args->args);
|
886
|
+
glb_policy->lb_channel = grpc_lb_policy_grpclb_create_lb_channel(
|
887
|
+
exec_ctx, lb_service_target_addresses, args->client_channel_factory,
|
888
|
+
lb_channel_args);
|
889
|
+
grpc_slice_hash_table_unref(exec_ctx, targets_info);
|
890
|
+
grpc_channel_args_destroy(exec_ctx, lb_channel_args);
|
891
|
+
gpr_free(lb_service_target_addresses);
|
892
|
+
if (glb_policy->lb_channel == NULL) {
|
893
|
+
gpr_free(glb_policy);
|
894
|
+
return NULL;
|
895
|
+
}
|
896
|
+
grpc_lb_policy_init(&glb_policy->base, &glb_lb_policy_vtable, args->combiner);
|
897
|
+
grpc_connectivity_state_init(&glb_policy->state_tracker, GRPC_CHANNEL_IDLE,
|
898
|
+
"grpclb");
|
899
|
+
return &glb_policy->base;
|
900
|
+
}
|
901
|
+
|
902
|
+
static void glb_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
903
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
904
|
+
GPR_ASSERT(glb_policy->pending_picks == NULL);
|
905
|
+
GPR_ASSERT(glb_policy->pending_pings == NULL);
|
906
|
+
gpr_free((void *)glb_policy->server_name);
|
907
|
+
grpc_channel_args_destroy(exec_ctx, glb_policy->args);
|
908
|
+
grpc_channel_destroy(glb_policy->lb_channel);
|
909
|
+
glb_policy->lb_channel = NULL;
|
910
|
+
grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker);
|
911
|
+
if (glb_policy->serverlist != NULL) {
|
912
|
+
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
|
913
|
+
}
|
914
|
+
gpr_free(glb_policy);
|
915
|
+
}
|
916
|
+
|
917
|
+
static void glb_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
918
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
919
|
+
glb_policy->shutting_down = true;
|
920
|
+
|
921
|
+
pending_pick *pp = glb_policy->pending_picks;
|
922
|
+
glb_policy->pending_picks = NULL;
|
923
|
+
pending_ping *pping = glb_policy->pending_pings;
|
924
|
+
glb_policy->pending_pings = NULL;
|
925
|
+
if (glb_policy->rr_policy) {
|
926
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "glb_shutdown");
|
927
|
+
}
|
928
|
+
grpc_connectivity_state_set(
|
929
|
+
exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_SHUTDOWN,
|
930
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"), "glb_shutdown");
|
931
|
+
/* We need a copy of the lb_call pointer because we can't cancell the call
|
932
|
+
* while holding glb_policy->mu: lb_on_server_status_received, invoked due to
|
933
|
+
* the cancel, needs to acquire that same lock */
|
934
|
+
grpc_call *lb_call = glb_policy->lb_call;
|
935
|
+
|
936
|
+
/* glb_policy->lb_call and this local lb_call must be consistent at this point
|
937
|
+
* because glb_policy->lb_call is only assigned in lb_call_init_locked as part
|
938
|
+
* of query_for_backends_locked, which can only be invoked while
|
939
|
+
* glb_policy->shutting_down is false. */
|
940
|
+
if (lb_call != NULL) {
|
941
|
+
grpc_call_cancel(lb_call, NULL);
|
942
|
+
/* lb_on_server_status_received will pick up the cancel and clean up */
|
943
|
+
}
|
944
|
+
while (pp != NULL) {
|
945
|
+
pending_pick *next = pp->next;
|
946
|
+
*pp->target = NULL;
|
947
|
+
grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
948
|
+
GRPC_ERROR_NONE);
|
949
|
+
pp = next;
|
950
|
+
}
|
951
|
+
|
952
|
+
while (pping != NULL) {
|
953
|
+
pending_ping *next = pping->next;
|
954
|
+
grpc_closure_sched(exec_ctx, &pping->wrapped_notify_arg.wrapper_closure,
|
955
|
+
GRPC_ERROR_NONE);
|
956
|
+
pping = next;
|
957
|
+
}
|
958
|
+
}
|
959
|
+
|
960
|
+
static void glb_cancel_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
961
|
+
grpc_connected_subchannel **target,
|
962
|
+
grpc_error *error) {
|
963
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
964
|
+
pending_pick *pp = glb_policy->pending_picks;
|
965
|
+
glb_policy->pending_picks = NULL;
|
966
|
+
while (pp != NULL) {
|
967
|
+
pending_pick *next = pp->next;
|
968
|
+
if (pp->target == target) {
|
969
|
+
*target = NULL;
|
970
|
+
grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
971
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
972
|
+
"Pick Cancelled", &error, 1));
|
973
|
+
} else {
|
974
|
+
pp->next = glb_policy->pending_picks;
|
975
|
+
glb_policy->pending_picks = pp;
|
976
|
+
}
|
977
|
+
pp = next;
|
978
|
+
}
|
979
|
+
GRPC_ERROR_UNREF(error);
|
980
|
+
}
|
981
|
+
|
982
|
+
static void glb_cancel_picks_locked(grpc_exec_ctx *exec_ctx,
|
983
|
+
grpc_lb_policy *pol,
|
984
|
+
uint32_t initial_metadata_flags_mask,
|
985
|
+
uint32_t initial_metadata_flags_eq,
|
986
|
+
grpc_error *error) {
|
987
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
988
|
+
pending_pick *pp = glb_policy->pending_picks;
|
989
|
+
glb_policy->pending_picks = NULL;
|
990
|
+
while (pp != NULL) {
|
991
|
+
pending_pick *next = pp->next;
|
992
|
+
if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) ==
|
993
|
+
initial_metadata_flags_eq) {
|
994
|
+
grpc_closure_sched(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
|
995
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
996
|
+
"Pick Cancelled", &error, 1));
|
997
|
+
} else {
|
998
|
+
pp->next = glb_policy->pending_picks;
|
999
|
+
glb_policy->pending_picks = pp;
|
1000
|
+
}
|
1001
|
+
pp = next;
|
1002
|
+
}
|
1003
|
+
GRPC_ERROR_UNREF(error);
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
1007
|
+
glb_lb_policy *glb_policy);
|
1008
|
+
static void start_picking_locked(grpc_exec_ctx *exec_ctx,
|
1009
|
+
glb_lb_policy *glb_policy) {
|
1010
|
+
glb_policy->started_picking = true;
|
1011
|
+
gpr_backoff_reset(&glb_policy->lb_call_backoff_state);
|
1012
|
+
query_for_backends_locked(exec_ctx, glb_policy);
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
static void glb_exit_idle_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
|
1016
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1017
|
+
if (!glb_policy->started_picking) {
|
1018
|
+
start_picking_locked(exec_ctx, glb_policy);
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
static int glb_pick_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
1023
|
+
const grpc_lb_policy_pick_args *pick_args,
|
1024
|
+
grpc_connected_subchannel **target, void **user_data,
|
1025
|
+
grpc_closure *on_complete) {
|
1026
|
+
if (pick_args->lb_token_mdelem_storage == NULL) {
|
1027
|
+
*target = NULL;
|
1028
|
+
grpc_closure_sched(exec_ctx, on_complete,
|
1029
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1030
|
+
"No mdelem storage for the LB token. Load reporting "
|
1031
|
+
"won't work without it. Failing"));
|
1032
|
+
return 0;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1036
|
+
glb_policy->deadline = pick_args->deadline;
|
1037
|
+
bool pick_done;
|
1038
|
+
|
1039
|
+
if (glb_policy->rr_policy != NULL) {
|
1040
|
+
if (grpc_lb_glb_trace) {
|
1041
|
+
gpr_log(GPR_INFO, "grpclb %p about to PICK from RR %p",
|
1042
|
+
(void *)glb_policy, (void *)glb_policy->rr_policy);
|
1043
|
+
}
|
1044
|
+
GRPC_LB_POLICY_REF(glb_policy->rr_policy, "glb_pick");
|
1045
|
+
|
1046
|
+
wrapped_rr_closure_arg *wc_arg = gpr_zalloc(sizeof(wrapped_rr_closure_arg));
|
1047
|
+
|
1048
|
+
grpc_closure_init(&wc_arg->wrapper_closure, wrapped_rr_closure, wc_arg,
|
1049
|
+
grpc_schedule_on_exec_ctx);
|
1050
|
+
wc_arg->rr_policy = glb_policy->rr_policy;
|
1051
|
+
wc_arg->target = target;
|
1052
|
+
wc_arg->wrapped_closure = on_complete;
|
1053
|
+
wc_arg->lb_token_mdelem_storage = pick_args->lb_token_mdelem_storage;
|
1054
|
+
wc_arg->initial_metadata = pick_args->initial_metadata;
|
1055
|
+
wc_arg->free_when_done = wc_arg;
|
1056
|
+
pick_done = pick_from_internal_rr_locked(exec_ctx, glb_policy->rr_policy,
|
1057
|
+
pick_args, target, wc_arg);
|
1058
|
+
} else {
|
1059
|
+
if (grpc_lb_glb_trace) {
|
1060
|
+
gpr_log(GPR_DEBUG,
|
1061
|
+
"No RR policy in grpclb instance %p. Adding to grpclb's pending "
|
1062
|
+
"picks",
|
1063
|
+
(void *)(glb_policy));
|
1064
|
+
}
|
1065
|
+
add_pending_pick(&glb_policy->pending_picks, pick_args, target,
|
1066
|
+
on_complete);
|
1067
|
+
|
1068
|
+
if (!glb_policy->started_picking) {
|
1069
|
+
start_picking_locked(exec_ctx, glb_policy);
|
1070
|
+
}
|
1071
|
+
pick_done = false;
|
1072
|
+
}
|
1073
|
+
return pick_done;
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
static grpc_connectivity_state glb_check_connectivity_locked(
|
1077
|
+
grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
1078
|
+
grpc_error **connectivity_error) {
|
1079
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1080
|
+
return grpc_connectivity_state_get(&glb_policy->state_tracker,
|
1081
|
+
connectivity_error);
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
static void glb_ping_one_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
|
1085
|
+
grpc_closure *closure) {
|
1086
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1087
|
+
if (glb_policy->rr_policy) {
|
1088
|
+
grpc_lb_policy_ping_one_locked(exec_ctx, glb_policy->rr_policy, closure);
|
1089
|
+
} else {
|
1090
|
+
add_pending_ping(&glb_policy->pending_pings, closure);
|
1091
|
+
if (!glb_policy->started_picking) {
|
1092
|
+
start_picking_locked(exec_ctx, glb_policy);
|
1093
|
+
}
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
static void glb_notify_on_state_change_locked(grpc_exec_ctx *exec_ctx,
|
1098
|
+
grpc_lb_policy *pol,
|
1099
|
+
grpc_connectivity_state *current,
|
1100
|
+
grpc_closure *notify) {
|
1101
|
+
glb_lb_policy *glb_policy = (glb_lb_policy *)pol;
|
1102
|
+
grpc_connectivity_state_notify_on_state_change(
|
1103
|
+
exec_ctx, &glb_policy->state_tracker, current, notify);
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
static void lb_on_server_status_received_locked(grpc_exec_ctx *exec_ctx,
|
1107
|
+
void *arg, grpc_error *error);
|
1108
|
+
static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1109
|
+
grpc_error *error);
|
1110
|
+
static void lb_call_init_locked(grpc_exec_ctx *exec_ctx,
|
1111
|
+
glb_lb_policy *glb_policy) {
|
1112
|
+
GPR_ASSERT(glb_policy->server_name != NULL);
|
1113
|
+
GPR_ASSERT(glb_policy->server_name[0] != '\0');
|
1114
|
+
GPR_ASSERT(!glb_policy->shutting_down);
|
1115
|
+
|
1116
|
+
/* Note the following LB call progresses every time there's activity in \a
|
1117
|
+
* glb_policy->base.interested_parties, which is comprised of the polling
|
1118
|
+
* entities from \a client_channel. */
|
1119
|
+
grpc_slice host = grpc_slice_from_copied_string(glb_policy->server_name);
|
1120
|
+
glb_policy->lb_call = grpc_channel_create_pollset_set_call(
|
1121
|
+
exec_ctx, glb_policy->lb_channel, NULL, GRPC_PROPAGATE_DEFAULTS,
|
1122
|
+
glb_policy->base.interested_parties,
|
1123
|
+
GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD,
|
1124
|
+
&host, glb_policy->deadline, NULL);
|
1125
|
+
|
1126
|
+
grpc_metadata_array_init(&glb_policy->lb_initial_metadata_recv);
|
1127
|
+
grpc_metadata_array_init(&glb_policy->lb_trailing_metadata_recv);
|
1128
|
+
|
1129
|
+
grpc_grpclb_request *request =
|
1130
|
+
grpc_grpclb_request_create(glb_policy->server_name);
|
1131
|
+
grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
|
1132
|
+
glb_policy->lb_request_payload =
|
1133
|
+
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
|
1134
|
+
grpc_slice_unref_internal(exec_ctx, request_payload_slice);
|
1135
|
+
grpc_grpclb_request_destroy(request);
|
1136
|
+
|
1137
|
+
grpc_closure_init(&glb_policy->lb_on_server_status_received,
|
1138
|
+
lb_on_server_status_received_locked, glb_policy,
|
1139
|
+
grpc_combiner_scheduler(glb_policy->base.combiner, false));
|
1140
|
+
grpc_closure_init(&glb_policy->lb_on_response_received,
|
1141
|
+
lb_on_response_received_locked, glb_policy,
|
1142
|
+
grpc_combiner_scheduler(glb_policy->base.combiner, false));
|
1143
|
+
|
1144
|
+
gpr_backoff_init(&glb_policy->lb_call_backoff_state,
|
1145
|
+
GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS,
|
1146
|
+
GRPC_GRPCLB_RECONNECT_BACKOFF_MULTIPLIER,
|
1147
|
+
GRPC_GRPCLB_RECONNECT_JITTER,
|
1148
|
+
GRPC_GRPCLB_MIN_CONNECT_TIMEOUT_SECONDS * 1000,
|
1149
|
+
GRPC_GRPCLB_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
static void lb_call_destroy_locked(grpc_exec_ctx *exec_ctx,
|
1153
|
+
glb_lb_policy *glb_policy) {
|
1154
|
+
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1155
|
+
grpc_call_destroy(glb_policy->lb_call);
|
1156
|
+
glb_policy->lb_call = NULL;
|
1157
|
+
|
1158
|
+
grpc_metadata_array_destroy(&glb_policy->lb_initial_metadata_recv);
|
1159
|
+
grpc_metadata_array_destroy(&glb_policy->lb_trailing_metadata_recv);
|
1160
|
+
|
1161
|
+
grpc_byte_buffer_destroy(glb_policy->lb_request_payload);
|
1162
|
+
grpc_slice_unref_internal(exec_ctx, glb_policy->lb_call_status_details);
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
/*
|
1166
|
+
* Auxiliary functions and LB client callbacks.
|
1167
|
+
*/
|
1168
|
+
static void query_for_backends_locked(grpc_exec_ctx *exec_ctx,
|
1169
|
+
glb_lb_policy *glb_policy) {
|
1170
|
+
GPR_ASSERT(glb_policy->lb_channel != NULL);
|
1171
|
+
if (glb_policy->shutting_down) return;
|
1172
|
+
|
1173
|
+
lb_call_init_locked(exec_ctx, glb_policy);
|
1174
|
+
|
1175
|
+
if (grpc_lb_glb_trace) {
|
1176
|
+
gpr_log(GPR_INFO, "Query for backends (grpclb: %p, lb_call: %p)",
|
1177
|
+
(void *)glb_policy, (void *)glb_policy->lb_call);
|
1178
|
+
}
|
1179
|
+
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1180
|
+
|
1181
|
+
grpc_call_error call_error;
|
1182
|
+
grpc_op ops[4];
|
1183
|
+
memset(ops, 0, sizeof(ops));
|
1184
|
+
|
1185
|
+
grpc_op *op = ops;
|
1186
|
+
op->op = GRPC_OP_SEND_INITIAL_METADATA;
|
1187
|
+
op->data.send_initial_metadata.count = 0;
|
1188
|
+
op->flags = 0;
|
1189
|
+
op->reserved = NULL;
|
1190
|
+
op++;
|
1191
|
+
|
1192
|
+
op->op = GRPC_OP_RECV_INITIAL_METADATA;
|
1193
|
+
op->data.recv_initial_metadata.recv_initial_metadata =
|
1194
|
+
&glb_policy->lb_initial_metadata_recv;
|
1195
|
+
op->flags = 0;
|
1196
|
+
op->reserved = NULL;
|
1197
|
+
op++;
|
1198
|
+
|
1199
|
+
GPR_ASSERT(glb_policy->lb_request_payload != NULL);
|
1200
|
+
op->op = GRPC_OP_SEND_MESSAGE;
|
1201
|
+
op->data.send_message.send_message = glb_policy->lb_request_payload;
|
1202
|
+
op->flags = 0;
|
1203
|
+
op->reserved = NULL;
|
1204
|
+
op++;
|
1205
|
+
|
1206
|
+
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
|
1207
|
+
op->data.recv_status_on_client.trailing_metadata =
|
1208
|
+
&glb_policy->lb_trailing_metadata_recv;
|
1209
|
+
op->data.recv_status_on_client.status = &glb_policy->lb_call_status;
|
1210
|
+
op->data.recv_status_on_client.status_details =
|
1211
|
+
&glb_policy->lb_call_status_details;
|
1212
|
+
op->flags = 0;
|
1213
|
+
op->reserved = NULL;
|
1214
|
+
op++;
|
1215
|
+
/* take a weak ref (won't prevent calling of \a glb_shutdown if the strong ref
|
1216
|
+
* count goes to zero) to be unref'd in lb_on_server_status_received */
|
1217
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "lb_on_server_status_received");
|
1218
|
+
call_error = grpc_call_start_batch_and_execute(
|
1219
|
+
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1220
|
+
&glb_policy->lb_on_server_status_received);
|
1221
|
+
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1222
|
+
|
1223
|
+
op = ops;
|
1224
|
+
op->op = GRPC_OP_RECV_MESSAGE;
|
1225
|
+
op->data.recv_message.recv_message = &glb_policy->lb_response_payload;
|
1226
|
+
op->flags = 0;
|
1227
|
+
op->reserved = NULL;
|
1228
|
+
op++;
|
1229
|
+
/* take another weak ref to be unref'd in lb_on_response_received */
|
1230
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "lb_on_response_received");
|
1231
|
+
call_error = grpc_call_start_batch_and_execute(
|
1232
|
+
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1233
|
+
&glb_policy->lb_on_response_received);
|
1234
|
+
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1238
|
+
grpc_error *error) {
|
1239
|
+
glb_lb_policy *glb_policy = arg;
|
1240
|
+
|
1241
|
+
grpc_op ops[2];
|
1242
|
+
memset(ops, 0, sizeof(ops));
|
1243
|
+
grpc_op *op = ops;
|
1244
|
+
if (glb_policy->lb_response_payload != NULL) {
|
1245
|
+
gpr_backoff_reset(&glb_policy->lb_call_backoff_state);
|
1246
|
+
/* Received data from the LB server. Look inside
|
1247
|
+
* glb_policy->lb_response_payload, for a serverlist. */
|
1248
|
+
grpc_byte_buffer_reader bbr;
|
1249
|
+
grpc_byte_buffer_reader_init(&bbr, glb_policy->lb_response_payload);
|
1250
|
+
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1251
|
+
grpc_byte_buffer_destroy(glb_policy->lb_response_payload);
|
1252
|
+
grpc_grpclb_serverlist *serverlist =
|
1253
|
+
grpc_grpclb_response_parse_serverlist(response_slice);
|
1254
|
+
if (serverlist != NULL) {
|
1255
|
+
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1256
|
+
grpc_slice_unref_internal(exec_ctx, response_slice);
|
1257
|
+
if (grpc_lb_glb_trace) {
|
1258
|
+
gpr_log(GPR_INFO, "Serverlist with %lu servers received",
|
1259
|
+
(unsigned long)serverlist->num_servers);
|
1260
|
+
for (size_t i = 0; i < serverlist->num_servers; ++i) {
|
1261
|
+
grpc_resolved_address addr;
|
1262
|
+
parse_server(serverlist->servers[i], &addr);
|
1263
|
+
char *ipport;
|
1264
|
+
grpc_sockaddr_to_string(&ipport, &addr, false);
|
1265
|
+
gpr_log(GPR_INFO, "Serverlist[%lu]: %s", (unsigned long)i, ipport);
|
1266
|
+
gpr_free(ipport);
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
/* update serverlist */
|
1271
|
+
if (serverlist->num_servers > 0) {
|
1272
|
+
if (grpc_grpclb_serverlist_equals(glb_policy->serverlist, serverlist)) {
|
1273
|
+
if (grpc_lb_glb_trace) {
|
1274
|
+
gpr_log(GPR_INFO,
|
1275
|
+
"Incoming server list identical to current, ignoring.");
|
1276
|
+
}
|
1277
|
+
grpc_grpclb_destroy_serverlist(serverlist);
|
1278
|
+
} else { /* new serverlist */
|
1279
|
+
if (glb_policy->serverlist != NULL) {
|
1280
|
+
/* dispose of the old serverlist */
|
1281
|
+
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
|
1282
|
+
}
|
1283
|
+
/* and update the copy in the glb_lb_policy instance. This serverlist
|
1284
|
+
* instance will be destroyed either upon the next update or in
|
1285
|
+
* glb_destroy() */
|
1286
|
+
glb_policy->serverlist = serverlist;
|
1287
|
+
|
1288
|
+
rr_handover_locked(exec_ctx, glb_policy);
|
1289
|
+
}
|
1290
|
+
} else {
|
1291
|
+
if (grpc_lb_glb_trace) {
|
1292
|
+
gpr_log(GPR_INFO,
|
1293
|
+
"Received empty server list. Picks will stay pending until a "
|
1294
|
+
"response with > 0 servers is received");
|
1295
|
+
}
|
1296
|
+
}
|
1297
|
+
} else { /* serverlist == NULL */
|
1298
|
+
gpr_log(GPR_ERROR, "Invalid LB response received: '%s'. Ignoring.",
|
1299
|
+
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
|
1300
|
+
grpc_slice_unref_internal(exec_ctx, response_slice);
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
if (!glb_policy->shutting_down) {
|
1304
|
+
/* keep listening for serverlist updates */
|
1305
|
+
op->op = GRPC_OP_RECV_MESSAGE;
|
1306
|
+
op->data.recv_message.recv_message = &glb_policy->lb_response_payload;
|
1307
|
+
op->flags = 0;
|
1308
|
+
op->reserved = NULL;
|
1309
|
+
op++;
|
1310
|
+
/* reuse the "lb_on_response_received" weak ref taken in
|
1311
|
+
* query_for_backends_locked() */
|
1312
|
+
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1313
|
+
exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
|
1314
|
+
&glb_policy->lb_on_response_received); /* loop */
|
1315
|
+
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1316
|
+
}
|
1317
|
+
} else { /* empty payload: call cancelled. */
|
1318
|
+
/* dispose of the "lb_on_response_received" weak ref taken in
|
1319
|
+
* query_for_backends_locked() and reused in every reception loop */
|
1320
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1321
|
+
"lb_on_response_received_empty_payload");
|
1322
|
+
}
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
static void lb_call_on_retry_timer_locked(grpc_exec_ctx *exec_ctx, void *arg,
|
1326
|
+
grpc_error *error) {
|
1327
|
+
glb_lb_policy *glb_policy = arg;
|
1328
|
+
|
1329
|
+
if (!glb_policy->shutting_down) {
|
1330
|
+
if (grpc_lb_glb_trace) {
|
1331
|
+
gpr_log(GPR_INFO, "Restaring call to LB server (grpclb %p)",
|
1332
|
+
(void *)glb_policy);
|
1333
|
+
}
|
1334
|
+
GPR_ASSERT(glb_policy->lb_call == NULL);
|
1335
|
+
query_for_backends_locked(exec_ctx, glb_policy);
|
1336
|
+
}
|
1337
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1338
|
+
"grpclb_on_retry_timer");
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
static void lb_on_server_status_received_locked(grpc_exec_ctx *exec_ctx,
|
1342
|
+
void *arg, grpc_error *error) {
|
1343
|
+
glb_lb_policy *glb_policy = arg;
|
1344
|
+
|
1345
|
+
GPR_ASSERT(glb_policy->lb_call != NULL);
|
1346
|
+
|
1347
|
+
if (grpc_lb_glb_trace) {
|
1348
|
+
char *status_details =
|
1349
|
+
grpc_slice_to_c_string(glb_policy->lb_call_status_details);
|
1350
|
+
gpr_log(GPR_DEBUG,
|
1351
|
+
"Status from LB server received. Status = %d, Details = '%s', "
|
1352
|
+
"(call: %p)",
|
1353
|
+
glb_policy->lb_call_status, status_details,
|
1354
|
+
(void *)glb_policy->lb_call);
|
1355
|
+
gpr_free(status_details);
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
/* We need to perform cleanups no matter what. */
|
1359
|
+
lb_call_destroy_locked(exec_ctx, glb_policy);
|
1360
|
+
|
1361
|
+
if (!glb_policy->shutting_down) {
|
1362
|
+
/* if we aren't shutting down, restart the LB client call after some time */
|
1363
|
+
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
1364
|
+
gpr_timespec next_try =
|
1365
|
+
gpr_backoff_step(&glb_policy->lb_call_backoff_state, now);
|
1366
|
+
if (grpc_lb_glb_trace) {
|
1367
|
+
gpr_log(GPR_DEBUG, "Connection to LB server lost (grpclb: %p)...",
|
1368
|
+
(void *)glb_policy);
|
1369
|
+
gpr_timespec timeout = gpr_time_sub(next_try, now);
|
1370
|
+
if (gpr_time_cmp(timeout, gpr_time_0(timeout.clock_type)) > 0) {
|
1371
|
+
gpr_log(GPR_DEBUG, "... retrying in %" PRId64 ".%09d seconds.",
|
1372
|
+
timeout.tv_sec, timeout.tv_nsec);
|
1373
|
+
} else {
|
1374
|
+
gpr_log(GPR_DEBUG, "... retrying immediately.");
|
1375
|
+
}
|
1376
|
+
}
|
1377
|
+
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_retry_timer");
|
1378
|
+
grpc_closure_init(
|
1379
|
+
&glb_policy->lb_on_call_retry, lb_call_on_retry_timer_locked,
|
1380
|
+
glb_policy, grpc_combiner_scheduler(glb_policy->base.combiner, false));
|
1381
|
+
grpc_timer_init(exec_ctx, &glb_policy->lb_call_retry_timer, next_try,
|
1382
|
+
&glb_policy->lb_on_call_retry, now);
|
1383
|
+
}
|
1384
|
+
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
|
1385
|
+
"lb_on_server_status_received");
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
/* Code wiring the policy with the rest of the core */
|
1389
|
+
static const grpc_lb_policy_vtable glb_lb_policy_vtable = {
|
1390
|
+
glb_destroy,
|
1391
|
+
glb_shutdown_locked,
|
1392
|
+
glb_pick_locked,
|
1393
|
+
glb_cancel_pick_locked,
|
1394
|
+
glb_cancel_picks_locked,
|
1395
|
+
glb_ping_one_locked,
|
1396
|
+
glb_exit_idle_locked,
|
1397
|
+
glb_check_connectivity_locked,
|
1398
|
+
glb_notify_on_state_change_locked};
|
1399
|
+
|
1400
|
+
static void glb_factory_ref(grpc_lb_policy_factory *factory) {}
|
1401
|
+
|
1402
|
+
static void glb_factory_unref(grpc_lb_policy_factory *factory) {}
|
1403
|
+
|
1404
|
+
static const grpc_lb_policy_factory_vtable glb_factory_vtable = {
|
1405
|
+
glb_factory_ref, glb_factory_unref, glb_create, "grpclb"};
|
1406
|
+
|
1407
|
+
static grpc_lb_policy_factory glb_lb_policy_factory = {&glb_factory_vtable};
|
1408
|
+
|
1409
|
+
grpc_lb_policy_factory *grpc_glb_lb_factory_create() {
|
1410
|
+
return &glb_lb_policy_factory;
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
/* Plugin registration */
|
1414
|
+
void grpc_lb_policy_grpclb_init() {
|
1415
|
+
grpc_register_lb_policy(grpc_glb_lb_factory_create());
|
1416
|
+
grpc_register_tracer("glb", &grpc_lb_glb_trace);
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
void grpc_lb_policy_grpclb_shutdown() {}
|