grpc 1.7.3 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +2106 -2116
- data/include/grpc/census.h +1 -432
- data/include/grpc/compression.h +9 -9
- data/include/grpc/grpc.h +115 -98
- data/include/grpc/grpc_cronet.h +3 -3
- data/include/grpc/grpc_posix.h +4 -4
- data/include/grpc/grpc_security.h +160 -88
- data/include/grpc/grpc_security_constants.h +7 -0
- data/include/grpc/impl/codegen/atm.h +9 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +13 -4
- data/include/grpc/impl/codegen/atm_gcc_sync.h +6 -5
- data/include/grpc/impl/codegen/atm_windows.h +23 -22
- data/include/grpc/impl/codegen/byte_buffer.h +14 -14
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/connectivity_state.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +32 -28
- data/include/grpc/impl/codegen/port_platform.h +48 -0
- data/include/grpc/impl/codegen/slice.h +10 -10
- data/include/grpc/impl/codegen/sync_generic.h +9 -3
- data/include/grpc/slice.h +16 -17
- data/include/grpc/slice_buffer.h +22 -22
- data/include/grpc/support/alloc.h +11 -11
- data/include/grpc/support/avl.h +28 -20
- data/include/grpc/support/cmdline.h +13 -13
- data/include/grpc/support/histogram.h +17 -17
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +2 -2
- data/include/grpc/support/subprocess.h +5 -5
- data/include/grpc/support/sync.h +43 -27
- data/include/grpc/support/thd.h +6 -6
- data/include/grpc/support/tls_gcc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/src/core/ext/census/{grpc_context.c → grpc_context.cc} +5 -8
- data/src/core/ext/filters/client_channel/backup_poller.cc +165 -0
- data/src/core/ext/{census/grpc_filter.h → filters/client_channel/backup_poller.h} +12 -7
- data/src/core/ext/filters/client_channel/{channel_connectivity.c → channel_connectivity.cc} +45 -42
- data/src/core/ext/filters/client_channel/{client_channel.c → client_channel.cc} +452 -417
- data/src/core/ext/filters/client_channel/client_channel.h +16 -8
- data/src/core/ext/filters/client_channel/{client_channel_factory.c → client_channel_factory.cc} +0 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +29 -21
- data/src/core/ext/filters/client_channel/{client_channel_plugin.c → client_channel_plugin.cc} +15 -19
- data/src/core/ext/filters/client_channel/{connector.c → connector.cc} +0 -0
- data/src/core/ext/filters/client_channel/connector.h +29 -21
- data/src/core/ext/filters/client_channel/{http_connect_handshaker.c → http_connect_handshaker.cc} +10 -10
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +8 -0
- data/src/core/ext/filters/client_channel/{http_proxy.c → http_proxy.cc} +14 -14
- data/src/core/ext/filters/client_channel/http_proxy.h +8 -0
- data/src/core/ext/filters/client_channel/{lb_policy.c → lb_policy.cc} +47 -48
- data/src/core/ext/filters/client_channel/lb_policy.h +76 -70
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{client_load_reporting_filter.c → client_load_reporting_filter.cc} +28 -29
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb.c → grpclb.cc} +554 -563
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +17 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_channel_secure.c → grpclb_channel_secure.cc} +17 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_client_stats.c → grpclb_client_stats.cc} +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{load_balancer_api.c → load_balancer_api.cc} +64 -67
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +20 -21
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +599 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +695 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +270 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +153 -0
- data/src/core/ext/filters/client_channel/{lb_policy_factory.c → lb_policy_factory.cc} +10 -10
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +48 -40
- data/src/core/ext/filters/client_channel/{lb_policy_registry.c → lb_policy_registry.cc} +9 -9
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +11 -3
- data/src/core/ext/filters/client_channel/{parse_address.c → parse_address.cc} +24 -24
- data/src/core/ext/filters/client_channel/parse_address.h +14 -6
- data/src/core/ext/filters/client_channel/{proxy_mapper.c → proxy_mapper.cc} +0 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +8 -0
- data/src/core/ext/filters/client_channel/{proxy_mapper_registry.c → proxy_mapper_registry.cc} +0 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +8 -0
- data/src/core/ext/filters/client_channel/{resolver.c → resolver.cc} +21 -23
- data/src/core/ext/filters/client_channel/resolver.h +33 -27
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{dns_resolver_ares.c → dns_resolver_ares.cc} +133 -133
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +18 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_ev_driver_posix.c → grpc_ares_ev_driver_posix.cc} +58 -56
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_wrapper.c → grpc_ares_wrapper.cc} +118 -115
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +23 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +60 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/{dns_resolver.c → dns_resolver.cc} +100 -94
- data/src/core/ext/filters/client_channel/resolver/fake/{fake_resolver.c → fake_resolver.cc} +14 -14
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +9 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/{sockaddr_resolver.c → sockaddr_resolver.cc} +60 -60
- data/src/core/ext/filters/client_channel/{resolver_factory.c → resolver_factory.cc} +2 -2
- data/src/core/ext/filters/client_channel/resolver_factory.h +27 -19
- data/src/core/ext/filters/client_channel/{resolver_registry.c → resolver_registry.cc} +35 -35
- data/src/core/ext/filters/client_channel/resolver_registry.h +18 -10
- data/src/core/ext/filters/client_channel/{retry_throttle.c → retry_throttle.cc} +10 -10
- data/src/core/ext/filters/client_channel/retry_throttle.h +8 -0
- data/src/core/ext/filters/client_channel/{subchannel.c → subchannel.cc} +210 -213
- data/src/core/ext/filters/client_channel/subchannel.h +68 -60
- data/src/core/ext/filters/client_channel/{subchannel_index.c → subchannel_index.cc} +52 -52
- data/src/core/ext/filters/client_channel/subchannel_index.h +22 -14
- data/src/core/ext/filters/client_channel/{uri_parser.c → uri_parser.cc} +29 -27
- data/src/core/ext/filters/client_channel/uri_parser.h +18 -10
- data/src/core/ext/filters/deadline/{deadline_filter.c → deadline_filter.cc} +12 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +11 -2
- data/src/core/ext/filters/http/client/{http_client_filter.c → http_client_filter.cc} +83 -83
- data/src/core/ext/filters/http/client/http_client_filter.h +8 -0
- data/src/core/ext/filters/http/{http_filters_plugin.c → http_filters_plugin.cc} +20 -21
- data/src/core/ext/filters/http/message_compress/{message_compress_filter.c → message_compress_filter.cc} +84 -83
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +9 -1
- data/src/core/ext/filters/http/server/{http_server_filter.c → http_server_filter.cc} +80 -78
- data/src/core/ext/filters/http/server/http_server_filter.h +8 -0
- data/src/core/ext/filters/load_reporting/{server_load_reporting_filter.c → server_load_reporting_filter.cc} +29 -29
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +9 -1
- data/src/core/ext/filters/load_reporting/{server_load_reporting_plugin.c → server_load_reporting_plugin.cc} +11 -11
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +13 -5
- data/src/core/ext/filters/max_age/{max_age_filter.c → max_age_filter.cc} +46 -56
- data/src/core/ext/filters/max_age/max_age_filter.h +8 -0
- data/src/core/ext/filters/message_size/{message_size_filter.c → message_size_filter.cc} +62 -40
- data/src/core/ext/filters/message_size/message_size_filter.h +8 -0
- data/src/core/ext/filters/workarounds/{workaround_cronet_compression_filter.c → workaround_cronet_compression_filter.cc} +11 -11
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +8 -0
- data/src/core/ext/filters/workarounds/{workaround_utils.c → workaround_utils.cc} +7 -7
- data/src/core/ext/filters/workarounds/workaround_utils.h +9 -1
- data/src/core/ext/transport/chttp2/alpn/{alpn.c → alpn.cc} +3 -3
- data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -2
- data/src/core/ext/transport/chttp2/client/{chttp2_connector.c → chttp2_connector.cc} +49 -45
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +8 -0
- data/src/core/ext/transport/chttp2/client/insecure/{channel_create.c → channel_create.cc} +28 -27
- data/src/core/ext/transport/chttp2/client/insecure/{channel_create_posix.c → channel_create_posix.cc} +14 -13
- data/src/core/ext/transport/chttp2/client/secure/{secure_channel_create.c → secure_channel_create.cc} +68 -66
- data/src/core/ext/transport/chttp2/server/{chttp2_server.c → chttp2_server.cc} +76 -77
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -3
- data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2.c → server_chttp2.cc} +3 -3
- data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2_posix.c → server_chttp2_posix.cc} +13 -12
- data/src/core/ext/transport/chttp2/server/secure/{server_secure_chttp2.c → server_secure_chttp2.cc} +12 -10
- data/src/core/ext/transport/chttp2/transport/{bin_decoder.c → bin_decoder.cc} +7 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +15 -7
- data/src/core/ext/transport/chttp2/transport/{bin_encoder.c → bin_encoder.cc} +11 -11
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{chttp2_plugin.c → chttp2_plugin.cc} +2 -9
- data/src/core/ext/transport/chttp2/transport/{chttp2_transport.c → chttp2_transport.cc} +778 -778
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -10
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +385 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +337 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{frame_data.c → frame_data.cc} +34 -34
- data/src/core/ext/transport/chttp2/transport/frame_data.h +25 -17
- data/src/core/ext/transport/chttp2/transport/{frame_goaway.c → frame_goaway.cc} +18 -18
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +18 -10
- data/src/core/ext/transport/chttp2/transport/{frame_ping.c → frame_ping.cc} +18 -19
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +12 -4
- data/src/core/ext/transport/chttp2/transport/{frame_rst_stream.c → frame_rst_stream.cc} +16 -16
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +16 -8
- data/src/core/ext/transport/chttp2/transport/{frame_settings.c → frame_settings.cc} +23 -24
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +17 -9
- data/src/core/ext/transport/chttp2/transport/{frame_window_update.c → frame_window_update.cc} +22 -24
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +14 -6
- data/src/core/ext/transport/chttp2/transport/{hpack_encoder.c → hpack_encoder.cc} +206 -161
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +23 -13
- data/src/core/ext/transport/chttp2/transport/{hpack_parser.c → hpack_parser.cc} +340 -334
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +30 -22
- data/src/core/ext/transport/chttp2/transport/{hpack_table.c → hpack_table.cc} +25 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +19 -11
- data/src/core/ext/transport/chttp2/transport/{http2_settings.c → http2_settings.cc} +1 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -2
- data/src/core/ext/transport/chttp2/transport/{huffsyms.c → huffsyms.cc} +0 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{incoming_metadata.c → incoming_metadata.cc} +14 -13
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +18 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +214 -340
- data/src/core/ext/transport/chttp2/transport/{parsing.c → parsing.cc} +152 -141
- data/src/core/ext/transport/chttp2/transport/{stream_lists.c → stream_lists.cc} +53 -53
- data/src/core/ext/transport/chttp2/transport/{stream_map.c → stream_map.cc} +35 -34
- data/src/core/ext/transport/chttp2/transport/stream_map.h +22 -14
- data/src/core/ext/transport/chttp2/transport/{varint.c → varint.cc} +0 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +8 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +636 -0
- data/src/core/ext/transport/inproc/{inproc_plugin.c → inproc_plugin.cc} +5 -6
- data/src/core/ext/transport/inproc/{inproc_transport.c → inproc_transport.cc} +479 -544
- data/src/core/ext/transport/inproc/inproc_transport.h +4 -4
- data/src/core/lib/backoff/backoff.cc +80 -0
- data/src/core/lib/backoff/backoff.h +83 -0
- data/src/core/lib/channel/{channel_args.c → channel_args.cc} +92 -92
- data/src/core/lib/channel/channel_args.h +45 -37
- data/src/core/lib/channel/{channel_stack.c → channel_stack.cc} +67 -68
- data/src/core/lib/channel/channel_stack.h +76 -75
- data/src/core/lib/channel/{channel_stack_builder.c → channel_stack_builder.cc} +91 -91
- data/src/core/lib/channel/channel_stack_builder.h +45 -45
- data/src/core/lib/channel/{connected_channel.c → connected_channel.cc} +70 -70
- data/src/core/lib/channel/connected_channel.h +12 -4
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/channel/{handshaker.c → handshaker.cc} +7 -9
- data/src/core/lib/channel/handshaker.h +9 -1
- data/src/core/lib/channel/{handshaker_factory.c → handshaker_factory.cc} +7 -7
- data/src/core/lib/channel/handshaker_factory.h +18 -10
- data/src/core/lib/channel/{handshaker_registry.c → handshaker_registry.cc} +0 -0
- data/src/core/lib/channel/handshaker_registry.h +8 -0
- data/src/core/lib/compression/algorithm_metadata.h +8 -0
- data/src/core/lib/compression/{compression.c → compression.cc} +9 -9
- data/src/core/lib/compression/{message_compress.c → message_compress.cc} +0 -0
- data/src/core/lib/compression/message_compress.h +8 -0
- data/src/core/lib/compression/{stream_compression.c → stream_compression.cc} +12 -12
- data/src/core/lib/compression/stream_compression.h +27 -19
- data/src/core/lib/compression/{stream_compression_gzip.c → stream_compression_gzip.cc} +35 -36
- data/src/core/lib/compression/stream_compression_gzip.h +8 -0
- data/src/core/lib/compression/{stream_compression_identity.c → stream_compression_identity.cc} +19 -20
- data/src/core/lib/compression/stream_compression_identity.h +8 -0
- data/src/core/lib/debug/{stats.c → stats.cc} +19 -19
- data/src/core/lib/debug/stats.h +17 -9
- data/src/core/lib/debug/{stats_data.c → stats_data.cc} +45 -22
- data/src/core/lib/debug/stats_data.h +58 -19
- data/src/core/lib/debug/trace.cc +142 -0
- data/src/core/lib/debug/trace.h +74 -14
- data/src/core/lib/http/{format_request.c → format_request.cc} +10 -10
- data/src/core/lib/http/format_request.h +12 -4
- data/src/core/lib/http/{httpcli.c → httpcli.cc} +80 -80
- data/src/core/lib/http/httpcli.h +41 -33
- data/src/core/lib/http/{httpcli_security_connector.c → httpcli_security_connector.cc} +69 -55
- data/src/core/lib/http/{parser.c → parser.cc} +42 -42
- data/src/core/lib/http/parser.h +28 -20
- data/src/core/lib/{support → iomgr}/block_annotate.h +17 -8
- data/src/core/lib/iomgr/{call_combiner.c → call_combiner.cc} +29 -17
- data/src/core/lib/iomgr/call_combiner.h +9 -1
- data/src/core/lib/iomgr/closure.h +220 -62
- data/src/core/lib/iomgr/{combiner.c → combiner.cc} +63 -62
- data/src/core/lib/iomgr/combiner.h +16 -8
- data/src/core/lib/iomgr/{endpoint.c → endpoint.cc} +6 -0
- data/src/core/lib/iomgr/endpoint.h +47 -32
- data/src/core/lib/iomgr/endpoint_pair.h +12 -4
- data/src/core/lib/iomgr/{endpoint_pair_posix.c → endpoint_pair_posix.cc} +3 -3
- data/src/core/lib/iomgr/{endpoint_pair_uv.c → endpoint_pair_uv.cc} +2 -2
- data/src/core/lib/iomgr/{endpoint_pair_windows.c → endpoint_pair_windows.cc} +6 -6
- data/src/core/lib/iomgr/{error.c → error.cc} +125 -124
- data/src/core/lib/iomgr/error.h +32 -27
- data/src/core/lib/iomgr/error_internal.h +11 -2
- data/src/core/lib/iomgr/{ev_epoll1_linux.c → ev_epoll1_linux.cc} +214 -215
- data/src/core/lib/iomgr/ev_epoll1_linux.h +9 -1
- data/src/core/lib/iomgr/ev_epollex_linux.cc +1488 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +9 -1
- data/src/core/lib/iomgr/{ev_epollsig_linux.c → ev_epollsig_linux.cc} +304 -305
- data/src/core/lib/iomgr/ev_epollsig_linux.h +12 -4
- data/src/core/lib/iomgr/{ev_poll_posix.c → ev_poll_posix.cc} +272 -283
- data/src/core/lib/iomgr/ev_poll_posix.h +10 -2
- data/src/core/lib/iomgr/ev_posix.cc +288 -0
- data/src/core/lib/iomgr/ev_posix.h +75 -67
- data/src/core/lib/iomgr/{ev_windows.c → ev_windows.cc} +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +177 -0
- data/src/core/lib/iomgr/exec_ctx.h +35 -13
- data/src/core/lib/iomgr/{executor.c → executor.cc} +34 -35
- data/src/core/lib/iomgr/executor.h +12 -4
- data/src/core/lib/iomgr/{fork_posix.c → fork_posix.cc} +0 -0
- data/src/core/lib/iomgr/{fork_windows.c → fork_windows.cc} +0 -0
- data/src/core/lib/iomgr/gethostname.h +9 -1
- data/src/core/lib/iomgr/{gethostname_fallback.c → gethostname_fallback.cc} +2 -1
- data/src/core/lib/iomgr/{gethostname_host_name_max.c → gethostname_host_name_max.cc} +4 -3
- data/src/core/lib/iomgr/{gethostname_sysconf.c → gethostname_sysconf.cc} +3 -2
- data/src/core/lib/iomgr/{iocp_windows.c → iocp_windows.cc} +23 -25
- data/src/core/lib/iomgr/iocp_windows.h +17 -3
- data/src/core/lib/iomgr/{iomgr.c → iomgr.cc} +25 -19
- data/src/core/lib/iomgr/iomgr.h +11 -3
- data/src/core/lib/iomgr/iomgr_internal.h +13 -5
- data/src/core/lib/iomgr/{iomgr_posix.c → iomgr_posix.cc} +0 -1
- data/src/core/lib/iomgr/{iomgr_uv.c → iomgr_uv.cc} +1 -1
- data/src/core/lib/iomgr/iomgr_uv.h +8 -0
- data/src/core/lib/iomgr/{iomgr_windows.c → iomgr_windows.cc} +0 -0
- data/src/core/lib/iomgr/{is_epollexclusive_available.c → is_epollexclusive_available.cc} +1 -1
- data/src/core/lib/iomgr/is_epollexclusive_available.h +8 -0
- data/src/core/lib/iomgr/{load_file.c → load_file.cc} +12 -12
- data/src/core/lib/iomgr/load_file.h +2 -2
- data/src/core/lib/iomgr/{lockfree_event.c → lockfree_event.cc} +76 -68
- data/src/core/lib/iomgr/lockfree_event.h +30 -11
- data/src/core/lib/iomgr/{network_status_tracker.c → network_status_tracker.cc} +3 -2
- data/src/core/lib/iomgr/network_status_tracker.h +2 -2
- data/src/core/lib/iomgr/{polling_entity.c → polling_entity.cc} +18 -18
- data/src/core/lib/iomgr/polling_entity.h +21 -13
- data/src/core/lib/iomgr/pollset.h +17 -11
- data/src/core/lib/iomgr/pollset_set.h +23 -15
- data/src/core/lib/iomgr/{pollset_set_uv.c → pollset_set_uv.cc} +0 -0
- data/src/core/lib/iomgr/{pollset_set_windows.c → pollset_set_windows.cc} +0 -0
- data/src/core/lib/iomgr/{pollset_uv.c → pollset_uv.cc} +31 -29
- data/src/core/lib/iomgr/pollset_uv.h +8 -0
- data/src/core/lib/iomgr/{pollset_windows.c → pollset_windows.cc} +24 -24
- data/src/core/lib/iomgr/pollset_windows.h +17 -4
- data/src/core/lib/iomgr/port.h +10 -0
- data/src/core/lib/iomgr/resolve_address.h +18 -10
- data/src/core/lib/iomgr/{resolve_address_posix.c → resolve_address_posix.cc} +40 -40
- data/src/core/lib/iomgr/{resolve_address_uv.c → resolve_address_uv.cc} +61 -56
- data/src/core/lib/iomgr/{resolve_address_windows.c → resolve_address_windows.cc} +36 -34
- data/src/core/lib/iomgr/{resource_quota.c → resource_quota.cc} +209 -180
- data/src/core/lib/iomgr/resource_quota.h +45 -37
- data/src/core/lib/iomgr/{sockaddr_utils.c → sockaddr_utils.cc} +61 -61
- data/src/core/lib/iomgr/sockaddr_utils.h +23 -15
- data/src/core/lib/iomgr/sockaddr_windows.h +6 -0
- data/src/core/lib/iomgr/{socket_factory_posix.c → socket_factory_posix.cc} +20 -20
- data/src/core/lib/iomgr/socket_factory_posix.h +15 -15
- data/src/core/lib/iomgr/{socket_mutator.c → socket_mutator.cc} +18 -18
- data/src/core/lib/iomgr/socket_mutator.h +11 -11
- data/src/core/lib/iomgr/socket_utils.h +9 -1
- data/src/core/lib/iomgr/{socket_utils_common_posix.c → socket_utils_common_posix.cc} +28 -28
- data/src/core/lib/iomgr/{socket_utils_linux.c → socket_utils_linux.cc} +3 -3
- data/src/core/lib/iomgr/{socket_utils_posix.c → socket_utils_posix.cc} +3 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +26 -18
- data/src/core/lib/iomgr/{socket_utils_uv.c → socket_utils_uv.cc} +1 -1
- data/src/core/lib/iomgr/{socket_utils_windows.c → socket_utils_windows.cc} +2 -2
- data/src/core/lib/iomgr/{socket_windows.c → socket_windows.cc} +18 -18
- data/src/core/lib/iomgr/socket_windows.h +26 -13
- data/src/core/lib/iomgr/tcp_client.h +14 -6
- data/src/core/lib/iomgr/{tcp_client_posix.c → tcp_client_posix.cc} +69 -70
- data/src/core/lib/iomgr/tcp_client_posix.h +11 -3
- data/src/core/lib/iomgr/{tcp_client_uv.c → tcp_client_uv.cc} +47 -48
- data/src/core/lib/iomgr/{tcp_client_windows.c → tcp_client_windows.cc} +46 -44
- data/src/core/lib/iomgr/{tcp_posix.c → tcp_posix.cc} +198 -175
- data/src/core/lib/iomgr/tcp_posix.h +15 -7
- data/src/core/lib/iomgr/tcp_server.h +31 -23
- data/src/core/lib/iomgr/{tcp_server_posix.c → tcp_server_posix.cc} +78 -77
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +27 -19
- data/src/core/lib/iomgr/{tcp_server_utils_posix_common.c → tcp_server_utils_posix_common.cc} +27 -27
- data/src/core/lib/iomgr/{tcp_server_utils_posix_ifaddrs.c → tcp_server_utils_posix_ifaddrs.cc} +25 -25
- data/src/core/lib/iomgr/{tcp_server_utils_posix_noifaddrs.c → tcp_server_utils_posix_noifaddrs.cc} +2 -2
- data/src/core/lib/iomgr/{tcp_server_uv.c → tcp_server_uv.cc} +133 -105
- data/src/core/lib/iomgr/{tcp_server_windows.c → tcp_server_windows.cc} +81 -77
- data/src/core/lib/iomgr/tcp_uv.cc +420 -0
- data/src/core/lib/iomgr/tcp_uv.h +18 -4
- data/src/core/lib/iomgr/{tcp_windows.c → tcp_windows.cc} +90 -79
- data/src/core/lib/iomgr/tcp_windows.h +17 -4
- data/src/core/lib/iomgr/{time_averaged_stats.c → time_averaged_stats.cc} +0 -0
- data/src/core/lib/iomgr/time_averaged_stats.h +8 -0
- data/src/core/lib/iomgr/timer.h +16 -9
- data/src/core/lib/iomgr/{timer_generic.c → timer_generic.cc} +130 -171
- data/src/core/lib/iomgr/timer_generic.h +4 -4
- data/src/core/lib/iomgr/{timer_heap.c → timer_heap.cc} +20 -21
- data/src/core/lib/iomgr/timer_heap.h +16 -8
- data/src/core/lib/iomgr/{timer_manager.c → timer_manager.cc} +54 -52
- data/src/core/lib/iomgr/timer_manager.h +8 -0
- data/src/core/lib/iomgr/{timer_uv.c → timer_uv.cc} +22 -24
- data/src/core/lib/iomgr/timer_uv.h +2 -2
- data/src/core/lib/iomgr/{udp_server.c → udp_server.cc} +75 -75
- data/src/core/lib/iomgr/udp_server.h +25 -17
- data/src/core/lib/iomgr/{unix_sockets_posix.c → unix_sockets_posix.cc} +22 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +14 -6
- data/src/core/lib/iomgr/{unix_sockets_posix_noop.c → unix_sockets_posix_noop.cc} +5 -5
- data/src/core/lib/iomgr/{wakeup_fd_cv.c → wakeup_fd_cv.cc} +2 -2
- data/src/core/lib/iomgr/wakeup_fd_cv.h +10 -0
- data/src/core/lib/iomgr/{wakeup_fd_eventfd.c → wakeup_fd_eventfd.cc} +0 -0
- data/src/core/lib/iomgr/{wakeup_fd_nospecial.c → wakeup_fd_nospecial.cc} +0 -0
- data/src/core/lib/iomgr/{wakeup_fd_pipe.c → wakeup_fd_pipe.cc} +1 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +9 -1
- data/src/core/lib/iomgr/{wakeup_fd_posix.c → wakeup_fd_posix.cc} +6 -7
- data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -0
- data/src/core/lib/json/{json.c → json.cc} +0 -0
- data/src/core/lib/json/json.h +8 -0
- data/src/core/lib/json/{json_reader.c → json_reader.cc} +18 -18
- data/src/core/lib/json/json_reader.h +26 -18
- data/src/core/lib/json/{json_string.c → json_string.cc} +57 -57
- data/src/core/lib/json/{json_writer.c → json_writer.cc} +20 -20
- data/src/core/lib/json/json_writer.h +23 -15
- data/src/core/lib/profiling/{basic_timers.c → basic_timers.cc} +34 -34
- data/src/core/lib/profiling/{stap_timers.c → stap_timers.cc} +5 -5
- data/src/core/lib/profiling/timers.h +6 -6
- data/src/core/lib/security/context/{security_context.c → security_context.cc} +98 -95
- data/src/core/lib/security/context/security_context.h +27 -29
- data/src/core/lib/security/credentials/composite/{composite_credentials.c → composite_credentials.cc} +79 -73
- data/src/core/lib/security/credentials/composite/composite_credentials.h +17 -9
- data/src/core/lib/security/credentials/{credentials.c → credentials.cc} +97 -92
- data/src/core/lib/security/credentials/credentials.h +83 -75
- data/src/core/lib/security/credentials/{credentials_metadata.c → credentials_metadata.cc} +7 -6
- data/src/core/lib/security/credentials/fake/{fake_credentials.c → fake_credentials.cc} +39 -36
- data/src/core/lib/security/credentials/fake/fake_credentials.h +13 -5
- data/src/core/lib/security/credentials/google_default/{credentials_generic.c → credentials_generic.cc} +5 -5
- data/src/core/lib/security/credentials/google_default/{google_default_credentials.c → google_default_credentials.cc} +55 -55
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +9 -1
- data/src/core/lib/security/credentials/iam/{iam_credentials.c → iam_credentials.cc} +19 -18
- data/src/core/lib/security/credentials/jwt/{json_token.c → json_token.cc} +80 -75
- data/src/core/lib/security/credentials/jwt/json_token.h +23 -15
- data/src/core/lib/security/credentials/jwt/{jwt_credentials.c → jwt_credentials.cc} +45 -41
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -3
- data/src/core/lib/security/credentials/jwt/{jwt_verifier.c → jwt_verifier.cc} +262 -252
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +38 -30
- data/src/core/lib/security/credentials/oauth2/{oauth2_credentials.c → oauth2_credentials.cc} +138 -141
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +30 -22
- data/src/core/lib/security/credentials/plugin/{plugin_credentials.c → plugin_credentials.cc} +52 -53
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +7 -7
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +344 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +27 -0
- data/src/core/lib/security/transport/auth_filters.h +16 -0
- data/src/core/lib/security/transport/{client_auth_filter.c → client_auth_filter.cc} +127 -115
- data/src/core/lib/security/transport/{lb_targets_info.c → lb_targets_info.cc} +16 -13
- data/src/core/lib/security/transport/lb_targets_info.h +11 -3
- data/src/core/lib/security/transport/{secure_endpoint.c → secure_endpoint.cc} +84 -76
- data/src/core/lib/security/transport/secure_endpoint.h +13 -5
- data/src/core/lib/security/transport/security_connector.cc +1121 -0
- data/src/core/lib/security/transport/security_connector.h +97 -79
- data/src/core/lib/security/transport/{security_handshaker.c → security_handshaker.cc} +139 -132
- data/src/core/lib/security/transport/security_handshaker.h +11 -3
- data/src/core/lib/security/transport/{server_auth_filter.c → server_auth_filter.cc} +68 -68
- data/src/core/lib/security/transport/{tsi_error.c → tsi_error.cc} +1 -1
- data/src/core/lib/security/transport/tsi_error.h +9 -1
- data/src/core/lib/security/util/{json_util.c → json_util.cc} +11 -11
- data/src/core/lib/security/util/json_util.h +12 -4
- data/src/core/lib/slice/{b64.c → b64.cc} +15 -15
- data/src/core/lib/slice/b64.h +12 -4
- data/src/core/lib/slice/{percent_encoding.c → percent_encoding.cc} +15 -15
- data/src/core/lib/slice/percent_encoding.h +11 -3
- data/src/core/lib/slice/{slice.c → slice.cc} +64 -64
- data/src/core/lib/slice/{slice_buffer.c → slice_buffer.cc} +38 -38
- data/src/core/lib/slice/{slice_hash_table.c → slice_hash_table.cc} +7 -7
- data/src/core/lib/slice/slice_hash_table.h +19 -11
- data/src/core/lib/slice/{slice_intern.c → slice_intern.cc} +35 -34
- data/src/core/lib/slice/slice_internal.h +17 -6
- data/src/core/lib/slice/{slice_string_helpers.c → slice_string_helpers.cc} +9 -9
- data/src/core/lib/slice/slice_string_helpers.h +3 -3
- data/src/core/lib/support/abstract.h +29 -0
- data/src/core/lib/support/{alloc.c → alloc.cc} +22 -22
- data/src/core/lib/support/{arena.c → arena.cc} +12 -12
- data/src/core/lib/support/arena.h +11 -3
- data/src/core/lib/support/{atm.c → atm.cc} +1 -1
- data/src/core/lib/support/{avl.c → avl.cc} +71 -70
- data/src/core/lib/support/{cmdline.c → cmdline.cc} +62 -62
- data/src/core/lib/support/{cpu_iphone.c → cpu_iphone.cc} +2 -0
- data/src/core/lib/support/{cpu_linux.c → cpu_linux.cc} +10 -0
- data/src/core/lib/support/{cpu_posix.c → cpu_posix.cc} +27 -4
- data/src/core/lib/support/{cpu_windows.c → cpu_windows.cc} +1 -0
- data/src/core/lib/support/env.h +3 -3
- data/src/core/lib/support/{env_linux.c → env_linux.cc} +11 -11
- data/src/core/lib/support/{env_posix.c → env_posix.cc} +4 -4
- data/src/core/lib/support/{env_windows.c → env_windows.cc} +5 -5
- data/src/core/lib/support/{fork.c → fork.cc} +2 -2
- data/src/core/lib/support/{histogram.c → histogram.cc} +25 -26
- data/src/core/lib/support/{host_port.c → host_port.cc} +16 -16
- data/src/core/lib/support/{log.c → log.cc} +8 -8
- data/src/core/lib/support/{log_android.c → log_android.cc} +7 -7
- data/src/core/lib/support/{log_linux.c → log_linux.cc} +8 -8
- data/src/core/lib/support/{log_posix.c → log_posix.cc} +9 -10
- data/src/core/lib/support/{log_windows.c → log_windows.cc} +7 -7
- data/src/core/lib/support/manual_constructor.h +211 -0
- data/src/core/lib/support/memory.h +41 -0
- data/src/core/lib/support/mpscq.cc +114 -0
- data/src/core/lib/support/mpscq.h +45 -7
- data/src/core/lib/support/{murmur_hash.c → murmur_hash.cc} +9 -12
- data/src/core/lib/support/murmur_hash.h +9 -1
- data/src/core/lib/support/spinlock.h +8 -1
- data/src/core/lib/support/{string.c → string.cc} +56 -55
- data/src/core/lib/support/string.h +21 -21
- data/src/core/lib/support/{string_posix.c → string_posix.cc} +5 -4
- data/src/core/lib/support/{string_util_windows.c → string_util_windows.cc} +9 -6
- data/src/core/lib/support/{string_windows.c → string_windows.cc} +3 -2
- data/src/core/lib/support/string_windows.h +8 -0
- data/src/core/lib/support/{subprocess_posix.c → subprocess_posix.cc} +13 -13
- data/src/core/lib/support/{subprocess_windows.c → subprocess_windows.cc} +9 -9
- data/src/core/lib/support/{sync.c → sync.cc} +22 -22
- data/src/core/lib/support/{sync_posix.c → sync_posix.cc} +6 -2
- data/src/core/lib/support/{sync_windows.c → sync_windows.cc} +14 -14
- data/src/core/lib/support/{thd.c → thd.cc} +0 -0
- data/src/core/lib/support/{thd_posix.c → thd_posix.cc} +10 -10
- data/src/core/lib/support/{thd_windows.c → thd_windows.cc} +10 -10
- data/src/core/lib/support/{time.c → time.cc} +0 -0
- data/src/core/lib/support/{time_posix.c → time_posix.cc} +5 -6
- data/src/core/lib/support/{time_precise.c → time_precise.cc} +6 -4
- data/src/core/lib/support/time_precise.h +9 -1
- data/src/core/lib/support/{time_windows.c → time_windows.cc} +2 -3
- data/src/core/lib/support/{tls_pthread.c → tls_pthread.cc} +2 -2
- data/src/core/lib/support/tmpfile.h +1 -1
- data/src/core/lib/support/{tmpfile_msys.c → tmpfile_msys.cc} +2 -2
- data/src/core/lib/support/{tmpfile_posix.c → tmpfile_posix.cc} +7 -7
- data/src/core/lib/support/{tmpfile_windows.c → tmpfile_windows.cc} +2 -2
- data/src/core/lib/support/{wrap_memcpy.c → wrap_memcpy.cc} +4 -2
- data/src/core/lib/surface/{alarm.c → alarm.cc} +32 -31
- data/src/core/lib/surface/alarm_internal.h +10 -2
- data/src/core/lib/surface/{api_trace.c → api_trace.cc} +1 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/{byte_buffer.c → byte_buffer.cc} +13 -13
- data/src/core/lib/surface/{byte_buffer_reader.c → byte_buffer_reader.cc} +9 -9
- data/src/core/lib/surface/{call.c → call.cc} +379 -372
- data/src/core/lib/surface/call.h +37 -38
- data/src/core/lib/surface/{call_details.c → call_details.cc} +0 -0
- data/src/core/lib/surface/{call_log_batch.c → call_log_batch.cc} +13 -11
- data/src/core/lib/surface/call_test_only.h +5 -5
- data/src/core/lib/surface/{channel.c → channel.cc} +94 -95
- data/src/core/lib/surface/channel.h +29 -21
- data/src/core/lib/surface/{channel_init.c → channel_init.cc} +13 -13
- data/src/core/lib/surface/channel_init.h +6 -6
- data/src/core/lib/surface/{channel_ping.c → channel_ping.cc} +12 -12
- data/src/core/lib/surface/{channel_stack_type.c → channel_stack_type.cc} +1 -1
- data/src/core/lib/surface/channel_stack_type.h +9 -1
- data/src/core/lib/surface/{completion_queue.c → completion_queue.cc} +416 -379
- data/src/core/lib/surface/completion_queue.h +29 -29
- data/src/core/lib/surface/{completion_queue_factory.c → completion_queue_factory.cc} +1 -1
- data/src/core/lib/surface/completion_queue_factory.h +8 -0
- data/src/core/lib/surface/{event_string.c → event_string.cc} +9 -9
- data/src/core/lib/surface/event_string.h +9 -1
- data/src/core/lib/surface/{init.c → init.cc} +16 -39
- data/src/core/lib/surface/init.h +8 -0
- data/src/core/lib/surface/{init_secure.c → init_secure.cc} +12 -25
- data/src/core/lib/surface/lame_client.cc +38 -40
- data/src/core/lib/surface/lame_client.h +8 -0
- data/src/core/lib/surface/{metadata_array.c → metadata_array.cc} +0 -0
- data/src/core/lib/surface/{server.c → server.cc} +340 -404
- data/src/core/lib/surface/server.h +22 -14
- data/src/core/lib/surface/{validate_metadata.c → validate_metadata.cc} +10 -9
- data/src/core/lib/surface/validate_metadata.h +10 -2
- data/src/core/lib/surface/{version.c → version.cc} +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +84 -0
- data/src/core/lib/transport/bdp_estimator.h +67 -42
- data/src/core/lib/transport/{byte_stream.c → byte_stream.cc} +51 -51
- data/src/core/lib/transport/byte_stream.h +41 -33
- data/src/core/lib/transport/{connectivity_state.c → connectivity_state.cc} +36 -40
- data/src/core/lib/transport/connectivity_state.h +29 -21
- data/src/core/lib/transport/{error_utils.c → error_utils.cc} +26 -22
- data/src/core/lib/transport/error_utils.h +18 -6
- data/src/core/lib/transport/{metadata.c → metadata.cc} +92 -88
- data/src/core/lib/transport/metadata.h +22 -20
- data/src/core/lib/transport/{metadata_batch.c → metadata_batch.cc} +78 -79
- data/src/core/lib/transport/metadata_batch.h +46 -45
- data/src/core/lib/transport/pid_controller.cc +48 -0
- data/src/core/lib/transport/pid_controller.h +84 -32
- data/src/core/lib/transport/{service_config.c → service_config.cc} +66 -48
- data/src/core/lib/transport/service_config.h +11 -2
- data/src/core/lib/transport/{static_metadata.c → static_metadata.cc} +2 -2
- data/src/core/lib/transport/static_metadata.h +30 -23
- data/src/core/lib/transport/{status_conversion.c → status_conversion.cc} +4 -3
- data/src/core/lib/transport/status_conversion.h +12 -2
- data/src/core/lib/transport/{timeout_encoding.c → timeout_encoding.cc} +28 -61
- data/src/core/lib/transport/timeout_encoding.h +11 -2
- data/src/core/lib/transport/{transport.c → transport.cc} +79 -79
- data/src/core/lib/transport/transport.h +78 -80
- data/src/core/lib/transport/transport_impl.h +27 -19
- data/src/core/lib/transport/{transport_op_string.c → transport_op_string.cc} +32 -30
- data/src/core/plugin_registry/{grpc_plugin_registry.c → grpc_plugin_registry.cc} +34 -38
- data/src/core/tsi/{fake_transport_security.c → fake_transport_security.cc} +141 -132
- data/src/core/tsi/fake_transport_security.h +5 -5
- data/src/core/tsi/{gts_transport_security.c → gts_transport_security.cc} +4 -4
- data/src/core/tsi/gts_transport_security.h +11 -3
- data/src/core/tsi/{ssl_transport_security.c → ssl_transport_security.cc} +309 -300
- data/src/core/tsi/ssl_transport_security.h +25 -25
- data/src/core/tsi/ssl_types.h +8 -0
- data/src/core/tsi/{transport_security.c → transport_security.cc} +94 -87
- data/src/core/tsi/transport_security.h +55 -55
- data/src/core/tsi/{transport_security_adapter.c → transport_security_adapter.cc} +58 -55
- data/src/core/tsi/transport_security_adapter.h +2 -2
- data/src/core/tsi/{transport_security_grpc.c → transport_security_grpc.cc} +21 -21
- data/src/core/tsi/transport_security_grpc.h +19 -19
- data/src/core/tsi/transport_security_interface.h +41 -41
- data/src/ruby/ext/grpc/extconf.rb +4 -2
- data/src/ruby/ext/grpc/rb_byte_buffer.c +5 -5
- data/src/ruby/ext/grpc/rb_byte_buffer.h +2 -2
- data/src/ruby/ext/grpc/rb_call.c +41 -42
- data/src/ruby/ext/grpc/rb_call.h +6 -6
- data/src/ruby/ext/grpc/rb_call_credentials.c +30 -30
- data/src/ruby/ext/grpc/rb_channel.c +87 -87
- data/src/ruby/ext/grpc/rb_channel_credentials.c +23 -23
- data/src/ruby/ext/grpc/rb_completion_queue.c +11 -11
- data/src/ruby/ext/grpc/rb_completion_queue.h +3 -3
- data/src/ruby/ext/grpc/rb_compression_options.c +20 -20
- data/src/ruby/ext/grpc/rb_event_thread.c +14 -14
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +8 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -58
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +242 -306
- data/src/ruby/ext/grpc/rb_server.c +23 -23
- data/src/ruby/ext/grpc/rb_server_credentials.c +13 -13
- data/src/ruby/lib/grpc/generic/rpc_server.rb +25 -12
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +14 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +29 -0
- data/third_party/cares/config_freebsd/ares_config.h +502 -0
- data/third_party/cares/config_openbsd/ares_config.h +502 -0
- metadata +302 -328
- data/src/core/ext/census/aggregation.h +0 -51
- data/src/core/ext/census/base_resources.c +0 -56
- data/src/core/ext/census/base_resources.h +0 -24
- data/src/core/ext/census/census_interface.h +0 -61
- data/src/core/ext/census/census_rpc_stats.h +0 -86
- data/src/core/ext/census/context.c +0 -496
- data/src/core/ext/census/gen/census.pb.c +0 -161
- data/src/core/ext/census/gen/census.pb.h +0 -280
- data/src/core/ext/census/gen/trace_context.pb.c +0 -39
- data/src/core/ext/census/gen/trace_context.pb.h +0 -78
- data/src/core/ext/census/grpc_filter.c +0 -196
- data/src/core/ext/census/grpc_plugin.c +0 -70
- data/src/core/ext/census/initialize.c +0 -51
- data/src/core/ext/census/intrusive_hash_map.c +0 -305
- data/src/core/ext/census/intrusive_hash_map.h +0 -152
- data/src/core/ext/census/intrusive_hash_map_internal.h +0 -48
- data/src/core/ext/census/mlog.c +0 -586
- data/src/core/ext/census/mlog.h +0 -80
- data/src/core/ext/census/operation.c +0 -48
- data/src/core/ext/census/placeholders.c +0 -49
- data/src/core/ext/census/resource.c +0 -303
- data/src/core/ext/census/resource.h +0 -48
- data/src/core/ext/census/rpc_metric_id.h +0 -36
- data/src/core/ext/census/trace_context.c +0 -71
- data/src/core/ext/census/trace_context.h +0 -56
- data/src/core/ext/census/trace_label.h +0 -46
- data/src/core/ext/census/trace_propagation.h +0 -48
- data/src/core/ext/census/trace_status.h +0 -30
- data/src/core/ext/census/trace_string.h +0 -35
- data/src/core/ext/census/tracing.c +0 -55
- data/src/core/ext/census/tracing.h +0 -109
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +0 -714
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +0 -924
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +0 -60
- data/src/core/ext/transport/chttp2/transport/flow_control.c +0 -502
- data/src/core/ext/transport/chttp2/transport/writing.c +0 -534
- data/src/core/lib/debug/trace.c +0 -146
- data/src/core/lib/iomgr/closure.c +0 -219
- data/src/core/lib/iomgr/ev_epollex_linux.c +0 -1461
- data/src/core/lib/iomgr/ev_posix.c +0 -266
- data/src/core/lib/iomgr/exec_ctx.c +0 -113
- data/src/core/lib/iomgr/tcp_uv.c +0 -381
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +0 -194
- data/src/core/lib/security/transport/security_connector.c +0 -914
- data/src/core/lib/support/backoff.c +0 -72
- data/src/core/lib/support/backoff.h +0 -56
- data/src/core/lib/support/mpscq.c +0 -79
- data/src/core/lib/support/stack_lockfree.c +0 -137
- data/src/core/lib/support/stack_lockfree.h +0 -38
- data/src/core/lib/transport/bdp_estimator.c +0 -110
- data/src/core/lib/transport/pid_controller.c +0 -63
@@ -22,18 +22,22 @@
|
|
22
22
|
#include "src/core/ext/filters/client_channel/resolver_factory.h"
|
23
23
|
#include "src/core/lib/iomgr/pollset_set.h"
|
24
24
|
|
25
|
+
#ifdef __cplusplus
|
26
|
+
extern "C" {
|
27
|
+
#endif
|
28
|
+
|
25
29
|
void grpc_resolver_registry_init();
|
26
30
|
void grpc_resolver_registry_shutdown(void);
|
27
31
|
|
28
32
|
/** Set the default URI prefix to \a default_prefix. */
|
29
|
-
void grpc_resolver_registry_set_default_prefix(const char
|
33
|
+
void grpc_resolver_registry_set_default_prefix(const char* default_prefix);
|
30
34
|
|
31
35
|
/** Register a resolver type.
|
32
36
|
URI's of \a scheme will be resolved with the given resolver.
|
33
37
|
If \a priority is greater than zero, then the resolver will be eligible
|
34
38
|
to resolve names that are passed in with no scheme. Higher priority
|
35
39
|
resolvers will be tried before lower priority schemes. */
|
36
|
-
void grpc_register_resolver_type(grpc_resolver_factory
|
40
|
+
void grpc_register_resolver_type(grpc_resolver_factory* factory);
|
37
41
|
|
38
42
|
/** Create a resolver given \a target.
|
39
43
|
First tries to parse \a target as a URI. If this succeeds, tries
|
@@ -48,22 +52,26 @@ void grpc_register_resolver_type(grpc_resolver_factory *factory);
|
|
48
52
|
(typically the set of arguments passed in from the client API).
|
49
53
|
\a pollset_set is used to drive IO in the name resolution process, it
|
50
54
|
should not be NULL. */
|
51
|
-
grpc_resolver
|
52
|
-
const grpc_channel_args
|
53
|
-
grpc_pollset_set
|
54
|
-
grpc_combiner
|
55
|
+
grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
|
56
|
+
const grpc_channel_args* args,
|
57
|
+
grpc_pollset_set* pollset_set,
|
58
|
+
grpc_combiner* combiner);
|
55
59
|
|
56
60
|
/** Find a resolver factory given a name and return an (owned-by-the-caller)
|
57
61
|
* reference to it */
|
58
|
-
grpc_resolver_factory
|
62
|
+
grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name);
|
59
63
|
|
60
64
|
/** Given a target, return a (freshly allocated with gpr_malloc) string
|
61
65
|
representing the default authority to pass from a client. */
|
62
|
-
char
|
66
|
+
char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target);
|
63
67
|
|
64
68
|
/** Returns a newly allocated string containing \a target, adding the
|
65
69
|
default prefix if needed. */
|
66
|
-
char
|
67
|
-
grpc_exec_ctx
|
70
|
+
char* grpc_resolver_factory_add_default_prefix_if_needed(
|
71
|
+
grpc_exec_ctx* exec_ctx, const char* target);
|
72
|
+
|
73
|
+
#ifdef __cplusplus
|
74
|
+
}
|
75
|
+
#endif
|
68
76
|
|
69
77
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */
|
@@ -48,7 +48,7 @@ static void get_replacement_throttle_data_if_needed(
|
|
48
48
|
grpc_server_retry_throttle_data* new_throttle_data =
|
49
49
|
(grpc_server_retry_throttle_data*)gpr_atm_acq_load(
|
50
50
|
&(*throttle_data)->replacement);
|
51
|
-
if (new_throttle_data ==
|
51
|
+
if (new_throttle_data == nullptr) return;
|
52
52
|
*throttle_data = new_throttle_data;
|
53
53
|
}
|
54
54
|
}
|
@@ -88,7 +88,7 @@ void grpc_server_retry_throttle_data_unref(
|
|
88
88
|
grpc_server_retry_throttle_data* replacement =
|
89
89
|
(grpc_server_retry_throttle_data*)gpr_atm_acq_load(
|
90
90
|
&throttle_data->replacement);
|
91
|
-
if (replacement !=
|
91
|
+
if (replacement != nullptr) {
|
92
92
|
grpc_server_retry_throttle_data_unref(replacement);
|
93
93
|
}
|
94
94
|
gpr_free(throttle_data);
|
@@ -109,7 +109,7 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
|
|
109
109
|
// the token count by scaling proportionately to the old data. This
|
110
110
|
// ensures that if we're already throttling retries on the old scale,
|
111
111
|
// we will start out doing the same thing on the new one.
|
112
|
-
if (old_throttle_data !=
|
112
|
+
if (old_throttle_data != nullptr) {
|
113
113
|
double token_fraction =
|
114
114
|
(int)gpr_atm_acq_load(&old_throttle_data->milli_tokens) /
|
115
115
|
(double)old_throttle_data->max_milli_tokens;
|
@@ -119,7 +119,7 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
|
|
119
119
|
(gpr_atm)initial_milli_tokens);
|
120
120
|
// If there was a pre-existing entry, mark it as stale and give it a
|
121
121
|
// pointer to the new entry, which is its replacement.
|
122
|
-
if (old_throttle_data !=
|
122
|
+
if (old_throttle_data != nullptr) {
|
123
123
|
grpc_server_retry_throttle_data_ref(throttle_data);
|
124
124
|
gpr_atm_rel_store(&old_throttle_data->replacement, (gpr_atm)throttle_data);
|
125
125
|
}
|
@@ -170,7 +170,7 @@ void grpc_retry_throttle_map_init() {
|
|
170
170
|
|
171
171
|
void grpc_retry_throttle_map_shutdown() {
|
172
172
|
gpr_mu_destroy(&g_mu);
|
173
|
-
gpr_avl_unref(g_avl,
|
173
|
+
gpr_avl_unref(g_avl, nullptr);
|
174
174
|
}
|
175
175
|
|
176
176
|
grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
|
@@ -178,12 +178,12 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
|
|
178
178
|
gpr_mu_lock(&g_mu);
|
179
179
|
grpc_server_retry_throttle_data* throttle_data =
|
180
180
|
(grpc_server_retry_throttle_data*)gpr_avl_get(g_avl, (char*)server_name,
|
181
|
-
|
182
|
-
if (throttle_data ==
|
181
|
+
nullptr);
|
182
|
+
if (throttle_data == nullptr) {
|
183
183
|
// Entry not found. Create a new one.
|
184
184
|
throttle_data = grpc_server_retry_throttle_data_create(
|
185
|
-
max_milli_tokens, milli_token_ratio,
|
186
|
-
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data,
|
185
|
+
max_milli_tokens, milli_token_ratio, nullptr);
|
186
|
+
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
|
187
187
|
} else {
|
188
188
|
if (throttle_data->max_milli_tokens != max_milli_tokens ||
|
189
189
|
throttle_data->milli_token_ratio != milli_token_ratio) {
|
@@ -191,7 +191,7 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
|
|
191
191
|
// the original one.
|
192
192
|
throttle_data = grpc_server_retry_throttle_data_create(
|
193
193
|
max_milli_tokens, milli_token_ratio, throttle_data);
|
194
|
-
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data,
|
194
|
+
g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
|
195
195
|
} else {
|
196
196
|
// Entry found. Increase refcount.
|
197
197
|
grpc_server_retry_throttle_data_ref(throttle_data);
|
@@ -21,6 +21,10 @@
|
|
21
21
|
|
22
22
|
#include <stdbool.h>
|
23
23
|
|
24
|
+
#ifdef __cplusplus
|
25
|
+
extern "C" {
|
26
|
+
#endif
|
27
|
+
|
24
28
|
/// Tracks retry throttling data for an individual server name.
|
25
29
|
typedef struct grpc_server_retry_throttle_data grpc_server_retry_throttle_data;
|
26
30
|
|
@@ -47,4 +51,8 @@ void grpc_retry_throttle_map_shutdown();
|
|
47
51
|
grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
|
48
52
|
const char* server_name, int max_milli_tokens, int milli_token_ratio);
|
49
53
|
|
54
|
+
#ifdef __cplusplus
|
55
|
+
}
|
56
|
+
#endif
|
57
|
+
|
50
58
|
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */
|
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
20
20
|
|
21
|
+
#include <inttypes.h>
|
21
22
|
#include <limits.h>
|
22
23
|
#include <string.h>
|
23
24
|
|
@@ -30,6 +31,7 @@
|
|
30
31
|
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
|
31
32
|
#include "src/core/ext/filters/client_channel/subchannel_index.h"
|
32
33
|
#include "src/core/ext/filters/client_channel/uri_parser.h"
|
34
|
+
#include "src/core/lib/backoff/backoff.h"
|
33
35
|
#include "src/core/lib/channel/channel_args.h"
|
34
36
|
#include "src/core/lib/channel/connected_channel.h"
|
35
37
|
#include "src/core/lib/debug/stats.h"
|
@@ -37,7 +39,6 @@
|
|
37
39
|
#include "src/core/lib/iomgr/timer.h"
|
38
40
|
#include "src/core/lib/profiling/timers.h"
|
39
41
|
#include "src/core/lib/slice/slice_internal.h"
|
40
|
-
#include "src/core/lib/support/backoff.h"
|
41
42
|
#include "src/core/lib/surface/channel.h"
|
42
43
|
#include "src/core/lib/surface/channel_init.h"
|
43
44
|
#include "src/core/lib/transport/connectivity_state.h"
|
@@ -51,27 +52,27 @@
|
|
51
52
|
#define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120
|
52
53
|
#define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2
|
53
54
|
|
54
|
-
#define GET_CONNECTED_SUBCHANNEL(subchannel, barrier)
|
55
|
-
((grpc_connected_subchannel
|
55
|
+
#define GET_CONNECTED_SUBCHANNEL(subchannel, barrier) \
|
56
|
+
((grpc_connected_subchannel*)(gpr_atm_##barrier##_load( \
|
56
57
|
&(subchannel)->connected_subchannel)))
|
57
58
|
|
58
59
|
typedef struct {
|
59
60
|
grpc_closure closure;
|
60
|
-
grpc_subchannel
|
61
|
+
grpc_subchannel* subchannel;
|
61
62
|
grpc_connectivity_state connectivity_state;
|
62
63
|
} state_watcher;
|
63
64
|
|
64
65
|
typedef struct external_state_watcher {
|
65
|
-
grpc_subchannel
|
66
|
-
grpc_pollset_set
|
67
|
-
grpc_closure
|
66
|
+
grpc_subchannel* subchannel;
|
67
|
+
grpc_pollset_set* pollset_set;
|
68
|
+
grpc_closure* notify;
|
68
69
|
grpc_closure closure;
|
69
|
-
struct external_state_watcher
|
70
|
-
struct external_state_watcher
|
70
|
+
struct external_state_watcher* next;
|
71
|
+
struct external_state_watcher* prev;
|
71
72
|
} external_state_watcher;
|
72
73
|
|
73
74
|
struct grpc_subchannel {
|
74
|
-
grpc_connector
|
75
|
+
grpc_connector* connector;
|
75
76
|
|
76
77
|
/** refcount
|
77
78
|
- lower INTERNAL_REF_BITS bits are for internal references:
|
@@ -81,12 +82,12 @@ struct grpc_subchannel {
|
|
81
82
|
gpr_atm ref_pair;
|
82
83
|
|
83
84
|
/** non-transport related channel filters */
|
84
|
-
const grpc_channel_filter
|
85
|
+
const grpc_channel_filter** filters;
|
85
86
|
size_t num_filters;
|
86
87
|
/** channel arguments */
|
87
|
-
grpc_channel_args
|
88
|
+
grpc_channel_args* args;
|
88
89
|
|
89
|
-
grpc_subchannel_key
|
90
|
+
grpc_subchannel_key* key;
|
90
91
|
|
91
92
|
/** set during connection */
|
92
93
|
grpc_connect_out_args connecting_result;
|
@@ -99,7 +100,7 @@ struct grpc_subchannel {
|
|
99
100
|
|
100
101
|
/** pollset_set tracking who's interested in a connection
|
101
102
|
being setup */
|
102
|
-
grpc_pollset_set
|
103
|
+
grpc_pollset_set* pollset_set;
|
103
104
|
|
104
105
|
/** active connection, or null; of type grpc_connected_subchannel */
|
105
106
|
gpr_atm connected_subchannel;
|
@@ -116,10 +117,10 @@ struct grpc_subchannel {
|
|
116
117
|
|
117
118
|
external_state_watcher root_external_state_watcher;
|
118
119
|
|
119
|
-
/** next connect attempt time */
|
120
|
-
gpr_timespec next_attempt;
|
121
120
|
/** backoff state */
|
122
|
-
|
121
|
+
grpc_backoff backoff_state;
|
122
|
+
grpc_backoff_result backoff_result;
|
123
|
+
|
123
124
|
/** do we have an active alarm? */
|
124
125
|
bool have_alarm;
|
125
126
|
/** have we started the backoff loop */
|
@@ -129,22 +130,22 @@ struct grpc_subchannel {
|
|
129
130
|
};
|
130
131
|
|
131
132
|
struct grpc_subchannel_call {
|
132
|
-
grpc_connected_subchannel
|
133
|
-
grpc_closure
|
133
|
+
grpc_connected_subchannel* connection;
|
134
|
+
grpc_closure* schedule_closure_after_destroy;
|
134
135
|
};
|
135
136
|
|
136
|
-
#define SUBCHANNEL_CALL_TO_CALL_STACK(call) ((grpc_call_stack
|
137
|
-
#define CHANNEL_STACK_FROM_CONNECTION(con) ((grpc_channel_stack
|
137
|
+
#define SUBCHANNEL_CALL_TO_CALL_STACK(call) ((grpc_call_stack*)((call) + 1))
|
138
|
+
#define CHANNEL_STACK_FROM_CONNECTION(con) ((grpc_channel_stack*)(con))
|
138
139
|
#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \
|
139
|
-
(((grpc_subchannel_call
|
140
|
+
(((grpc_subchannel_call*)(callstack)) - 1)
|
140
141
|
|
141
|
-
static void subchannel_connected(grpc_exec_ctx
|
142
|
-
grpc_error
|
142
|
+
static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* subchannel,
|
143
|
+
grpc_error* error);
|
143
144
|
|
144
145
|
#ifndef NDEBUG
|
145
146
|
#define REF_REASON reason
|
146
147
|
#define REF_MUTATE_EXTRA_ARGS \
|
147
|
-
GRPC_SUBCHANNEL_REF_EXTRA_ARGS, const char
|
148
|
+
GRPC_SUBCHANNEL_REF_EXTRA_ARGS, const char* purpose
|
148
149
|
#define REF_MUTATE_PURPOSE(x) , file, line, reason, x
|
149
150
|
#else
|
150
151
|
#define REF_REASON ""
|
@@ -156,21 +157,21 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
|
|
156
157
|
* connection implementation
|
157
158
|
*/
|
158
159
|
|
159
|
-
static void connection_destroy(grpc_exec_ctx
|
160
|
-
grpc_error
|
161
|
-
grpc_connected_subchannel
|
160
|
+
static void connection_destroy(grpc_exec_ctx* exec_ctx, void* arg,
|
161
|
+
grpc_error* error) {
|
162
|
+
grpc_connected_subchannel* c = (grpc_connected_subchannel*)arg;
|
162
163
|
grpc_channel_stack_destroy(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c));
|
163
164
|
gpr_free(c);
|
164
165
|
}
|
165
166
|
|
166
|
-
grpc_connected_subchannel
|
167
|
-
grpc_connected_subchannel
|
167
|
+
grpc_connected_subchannel* grpc_connected_subchannel_ref(
|
168
|
+
grpc_connected_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
168
169
|
GRPC_CHANNEL_STACK_REF(CHANNEL_STACK_FROM_CONNECTION(c), REF_REASON);
|
169
170
|
return c;
|
170
171
|
}
|
171
172
|
|
172
|
-
void grpc_connected_subchannel_unref(grpc_exec_ctx
|
173
|
-
grpc_connected_subchannel
|
173
|
+
void grpc_connected_subchannel_unref(grpc_exec_ctx* exec_ctx,
|
174
|
+
grpc_connected_subchannel* c
|
174
175
|
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
175
176
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c),
|
176
177
|
REF_REASON);
|
@@ -180,10 +181,10 @@ void grpc_connected_subchannel_unref(grpc_exec_ctx *exec_ctx,
|
|
180
181
|
* grpc_subchannel implementation
|
181
182
|
*/
|
182
183
|
|
183
|
-
static void subchannel_destroy(grpc_exec_ctx
|
184
|
-
grpc_error
|
185
|
-
grpc_subchannel
|
186
|
-
gpr_free((void
|
184
|
+
static void subchannel_destroy(grpc_exec_ctx* exec_ctx, void* arg,
|
185
|
+
grpc_error* error) {
|
186
|
+
grpc_subchannel* c = (grpc_subchannel*)arg;
|
187
|
+
gpr_free((void*)c->filters);
|
187
188
|
grpc_channel_args_destroy(exec_ctx, c->args);
|
188
189
|
grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker);
|
189
190
|
grpc_connector_unref(exec_ctx, c->connector);
|
@@ -193,12 +194,12 @@ static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg,
|
|
193
194
|
gpr_free(c);
|
194
195
|
}
|
195
196
|
|
196
|
-
static gpr_atm ref_mutate(grpc_subchannel
|
197
|
+
static gpr_atm ref_mutate(grpc_subchannel* c, gpr_atm delta,
|
197
198
|
int barrier REF_MUTATE_EXTRA_ARGS) {
|
198
199
|
gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&c->ref_pair, delta)
|
199
200
|
: gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta);
|
200
201
|
#ifndef NDEBUG
|
201
|
-
if (
|
202
|
+
if (grpc_trace_stream_refcount.enabled()) {
|
202
203
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
203
204
|
"SUBCHANNEL: %p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", c,
|
204
205
|
purpose, old_val, old_val + delta, reason);
|
@@ -207,8 +208,8 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta,
|
|
207
208
|
return old_val;
|
208
209
|
}
|
209
210
|
|
210
|
-
grpc_subchannel
|
211
|
-
grpc_subchannel
|
211
|
+
grpc_subchannel* grpc_subchannel_ref(
|
212
|
+
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
212
213
|
gpr_atm old_refs;
|
213
214
|
old_refs = ref_mutate(c, (1 << INTERNAL_REF_BITS),
|
214
215
|
0 REF_MUTATE_PURPOSE("STRONG_REF"));
|
@@ -216,17 +217,17 @@ grpc_subchannel *grpc_subchannel_ref(
|
|
216
217
|
return c;
|
217
218
|
}
|
218
219
|
|
219
|
-
grpc_subchannel
|
220
|
-
grpc_subchannel
|
220
|
+
grpc_subchannel* grpc_subchannel_weak_ref(
|
221
|
+
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
221
222
|
gpr_atm old_refs;
|
222
223
|
old_refs = ref_mutate(c, 1, 0 REF_MUTATE_PURPOSE("WEAK_REF"));
|
223
224
|
GPR_ASSERT(old_refs != 0);
|
224
225
|
return c;
|
225
226
|
}
|
226
227
|
|
227
|
-
grpc_subchannel
|
228
|
-
grpc_subchannel
|
229
|
-
if (!c) return
|
228
|
+
grpc_subchannel* grpc_subchannel_ref_from_weak_ref(
|
229
|
+
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
230
|
+
if (!c) return nullptr;
|
230
231
|
for (;;) {
|
231
232
|
gpr_atm old_refs = gpr_atm_acq_load(&c->ref_pair);
|
232
233
|
if (old_refs >= (1 << INTERNAL_REF_BITS)) {
|
@@ -235,13 +236,13 @@ grpc_subchannel *grpc_subchannel_ref_from_weak_ref(
|
|
235
236
|
return c;
|
236
237
|
}
|
237
238
|
} else {
|
238
|
-
return
|
239
|
+
return nullptr;
|
239
240
|
}
|
240
241
|
}
|
241
242
|
}
|
242
243
|
|
243
|
-
static void disconnect(grpc_exec_ctx
|
244
|
-
grpc_connected_subchannel
|
244
|
+
static void disconnect(grpc_exec_ctx* exec_ctx, grpc_subchannel* c) {
|
245
|
+
grpc_connected_subchannel* con;
|
245
246
|
grpc_subchannel_index_unregister(exec_ctx, c->key, c);
|
246
247
|
gpr_mu_lock(&c->mu);
|
247
248
|
GPR_ASSERT(!c->disconnected);
|
@@ -250,15 +251,15 @@ static void disconnect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
|
|
250
251
|
exec_ctx, c->connector,
|
251
252
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
|
252
253
|
con = GET_CONNECTED_SUBCHANNEL(c, no_barrier);
|
253
|
-
if (con !=
|
254
|
+
if (con != nullptr) {
|
254
255
|
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, con, "connection");
|
255
256
|
gpr_atm_no_barrier_store(&c->connected_subchannel, (gpr_atm)0xdeadbeef);
|
256
257
|
}
|
257
258
|
gpr_mu_unlock(&c->mu);
|
258
259
|
}
|
259
260
|
|
260
|
-
void grpc_subchannel_unref(grpc_exec_ctx
|
261
|
-
grpc_subchannel
|
261
|
+
void grpc_subchannel_unref(grpc_exec_ctx* exec_ctx,
|
262
|
+
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
262
263
|
gpr_atm old_refs;
|
263
264
|
// add a weak ref and subtract a strong ref (atomically)
|
264
265
|
old_refs = ref_mutate(c, (gpr_atm)1 - (gpr_atm)(1 << INTERNAL_REF_BITS),
|
@@ -269,63 +270,64 @@ void grpc_subchannel_unref(grpc_exec_ctx *exec_ctx,
|
|
269
270
|
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "strong-unref");
|
270
271
|
}
|
271
272
|
|
272
|
-
void grpc_subchannel_weak_unref(grpc_exec_ctx
|
273
|
-
grpc_subchannel
|
273
|
+
void grpc_subchannel_weak_unref(grpc_exec_ctx* exec_ctx,
|
274
|
+
grpc_subchannel* c
|
274
275
|
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
275
276
|
gpr_atm old_refs;
|
276
277
|
old_refs = ref_mutate(c, -(gpr_atm)1, 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
|
277
278
|
if (old_refs == 1) {
|
278
|
-
GRPC_CLOSURE_SCHED(
|
279
|
-
|
280
|
-
|
279
|
+
GRPC_CLOSURE_SCHED(
|
280
|
+
exec_ctx,
|
281
|
+
GRPC_CLOSURE_CREATE(subchannel_destroy, c, grpc_schedule_on_exec_ctx),
|
282
|
+
GRPC_ERROR_NONE);
|
281
283
|
}
|
282
284
|
}
|
283
285
|
|
284
|
-
grpc_subchannel
|
285
|
-
grpc_connector
|
286
|
-
const grpc_subchannel_args
|
287
|
-
grpc_subchannel_key
|
288
|
-
grpc_subchannel
|
286
|
+
grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
|
287
|
+
grpc_connector* connector,
|
288
|
+
const grpc_subchannel_args* args) {
|
289
|
+
grpc_subchannel_key* key = grpc_subchannel_key_create(args);
|
290
|
+
grpc_subchannel* c = grpc_subchannel_index_find(exec_ctx, key);
|
289
291
|
if (c) {
|
290
292
|
grpc_subchannel_key_destroy(exec_ctx, key);
|
291
293
|
return c;
|
292
294
|
}
|
293
295
|
|
294
296
|
GRPC_STATS_INC_CLIENT_SUBCHANNELS_CREATED(exec_ctx);
|
295
|
-
c = (grpc_subchannel
|
297
|
+
c = (grpc_subchannel*)gpr_zalloc(sizeof(*c));
|
296
298
|
c->key = key;
|
297
299
|
gpr_atm_no_barrier_store(&c->ref_pair, 1 << INTERNAL_REF_BITS);
|
298
300
|
c->connector = connector;
|
299
301
|
grpc_connector_ref(c->connector);
|
300
302
|
c->num_filters = args->filter_count;
|
301
303
|
if (c->num_filters > 0) {
|
302
|
-
c->filters = (const grpc_channel_filter
|
303
|
-
sizeof(grpc_channel_filter
|
304
|
-
memcpy((void
|
305
|
-
sizeof(grpc_channel_filter
|
304
|
+
c->filters = (const grpc_channel_filter**)gpr_malloc(
|
305
|
+
sizeof(grpc_channel_filter*) * c->num_filters);
|
306
|
+
memcpy((void*)c->filters, args->filters,
|
307
|
+
sizeof(grpc_channel_filter*) * c->num_filters);
|
306
308
|
} else {
|
307
|
-
c->filters =
|
309
|
+
c->filters = nullptr;
|
308
310
|
}
|
309
311
|
c->pollset_set = grpc_pollset_set_create();
|
310
|
-
grpc_resolved_address
|
311
|
-
(grpc_resolved_address
|
312
|
+
grpc_resolved_address* addr =
|
313
|
+
(grpc_resolved_address*)gpr_malloc(sizeof(*addr));
|
312
314
|
grpc_get_subchannel_address_arg(exec_ctx, args->args, addr);
|
313
|
-
grpc_resolved_address
|
314
|
-
grpc_channel_args
|
315
|
+
grpc_resolved_address* new_address = nullptr;
|
316
|
+
grpc_channel_args* new_args = nullptr;
|
315
317
|
if (grpc_proxy_mappers_map_address(exec_ctx, addr, args->args, &new_address,
|
316
318
|
&new_args)) {
|
317
|
-
GPR_ASSERT(new_address !=
|
319
|
+
GPR_ASSERT(new_address != nullptr);
|
318
320
|
gpr_free(addr);
|
319
321
|
addr = new_address;
|
320
322
|
}
|
321
|
-
static const char
|
323
|
+
static const char* keys_to_remove[] = {GRPC_ARG_SUBCHANNEL_ADDRESS};
|
322
324
|
grpc_arg new_arg = grpc_create_subchannel_address_arg(addr);
|
323
325
|
gpr_free(addr);
|
324
326
|
c->args = grpc_channel_args_copy_and_add_and_remove(
|
325
|
-
new_args !=
|
327
|
+
new_args != nullptr ? new_args : args->args, keys_to_remove,
|
326
328
|
GPR_ARRAY_SIZE(keys_to_remove), &new_arg, 1);
|
327
329
|
gpr_free(new_arg.value.string);
|
328
|
-
if (new_args !=
|
330
|
+
if (new_args != nullptr) grpc_channel_args_destroy(exec_ctx, new_args);
|
329
331
|
c->root_external_state_watcher.next = c->root_external_state_watcher.prev =
|
330
332
|
&c->root_external_state_watcher;
|
331
333
|
GRPC_CLOSURE_INIT(&c->connected, subchannel_connected, c,
|
@@ -343,31 +345,27 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
|
|
343
345
|
"grpc.testing.fixed_reconnect_backoff_ms")) {
|
344
346
|
fixed_reconnect_backoff = true;
|
345
347
|
initial_backoff_ms = min_backoff_ms = max_backoff_ms =
|
346
|
-
grpc_channel_arg_get_integer(
|
347
|
-
|
348
|
-
(grpc_integer_options){initial_backoff_ms, 100, INT_MAX});
|
348
|
+
grpc_channel_arg_get_integer(&c->args->args[i],
|
349
|
+
{initial_backoff_ms, 100, INT_MAX});
|
349
350
|
} else if (0 == strcmp(c->args->args[i].key,
|
350
351
|
GRPC_ARG_MIN_RECONNECT_BACKOFF_MS)) {
|
351
352
|
fixed_reconnect_backoff = false;
|
352
353
|
min_backoff_ms = grpc_channel_arg_get_integer(
|
353
|
-
&c->args->args[i],
|
354
|
-
(grpc_integer_options){min_backoff_ms, 100, INT_MAX});
|
354
|
+
&c->args->args[i], {min_backoff_ms, 100, INT_MAX});
|
355
355
|
} else if (0 == strcmp(c->args->args[i].key,
|
356
356
|
GRPC_ARG_MAX_RECONNECT_BACKOFF_MS)) {
|
357
357
|
fixed_reconnect_backoff = false;
|
358
358
|
max_backoff_ms = grpc_channel_arg_get_integer(
|
359
|
-
&c->args->args[i],
|
360
|
-
(grpc_integer_options){max_backoff_ms, 100, INT_MAX});
|
359
|
+
&c->args->args[i], {max_backoff_ms, 100, INT_MAX});
|
361
360
|
} else if (0 == strcmp(c->args->args[i].key,
|
362
361
|
GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS)) {
|
363
362
|
fixed_reconnect_backoff = false;
|
364
363
|
initial_backoff_ms = grpc_channel_arg_get_integer(
|
365
|
-
&c->args->args[i],
|
366
|
-
(grpc_integer_options){initial_backoff_ms, 100, INT_MAX});
|
364
|
+
&c->args->args[i], {initial_backoff_ms, 100, INT_MAX});
|
367
365
|
}
|
368
366
|
}
|
369
367
|
}
|
370
|
-
|
368
|
+
grpc_backoff_init(
|
371
369
|
&c->backoff_state, initial_backoff_ms,
|
372
370
|
fixed_reconnect_backoff ? 1.0
|
373
371
|
: GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER,
|
@@ -378,12 +376,12 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
|
|
378
376
|
return grpc_subchannel_index_register(exec_ctx, key, c);
|
379
377
|
}
|
380
378
|
|
381
|
-
static void continue_connect_locked(grpc_exec_ctx
|
382
|
-
grpc_subchannel
|
379
|
+
static void continue_connect_locked(grpc_exec_ctx* exec_ctx,
|
380
|
+
grpc_subchannel* c) {
|
383
381
|
grpc_connect_in_args args;
|
384
382
|
|
385
383
|
args.interested_parties = c->pollset_set;
|
386
|
-
args.deadline = c->
|
384
|
+
args.deadline = c->backoff_result.current_deadline;
|
387
385
|
args.channel_args = c->args;
|
388
386
|
|
389
387
|
grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
|
@@ -393,8 +391,8 @@ static void continue_connect_locked(grpc_exec_ctx *exec_ctx,
|
|
393
391
|
&c->connected);
|
394
392
|
}
|
395
393
|
|
396
|
-
grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel
|
397
|
-
grpc_error
|
394
|
+
grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel* c,
|
395
|
+
grpc_error** error) {
|
398
396
|
grpc_connectivity_state state;
|
399
397
|
gpr_mu_lock(&c->mu);
|
400
398
|
state = grpc_connectivity_state_get(&c->state_tracker, error);
|
@@ -402,11 +400,11 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c,
|
|
402
400
|
return state;
|
403
401
|
}
|
404
402
|
|
405
|
-
static void on_external_state_watcher_done(grpc_exec_ctx
|
406
|
-
grpc_error
|
407
|
-
external_state_watcher
|
408
|
-
grpc_closure
|
409
|
-
if (w->pollset_set !=
|
403
|
+
static void on_external_state_watcher_done(grpc_exec_ctx* exec_ctx, void* arg,
|
404
|
+
grpc_error* error) {
|
405
|
+
external_state_watcher* w = (external_state_watcher*)arg;
|
406
|
+
grpc_closure* follow_up = w->notify;
|
407
|
+
if (w->pollset_set != nullptr) {
|
410
408
|
grpc_pollset_set_del_pollset_set(exec_ctx, w->subchannel->pollset_set,
|
411
409
|
w->pollset_set);
|
412
410
|
}
|
@@ -419,8 +417,8 @@ static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
419
417
|
GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error));
|
420
418
|
}
|
421
419
|
|
422
|
-
static void on_alarm(grpc_exec_ctx
|
423
|
-
grpc_subchannel
|
420
|
+
static void on_alarm(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
|
421
|
+
grpc_subchannel* c = (grpc_subchannel*)arg;
|
424
422
|
gpr_mu_lock(&c->mu);
|
425
423
|
c->have_alarm = false;
|
426
424
|
if (c->disconnected) {
|
@@ -431,8 +429,7 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|
431
429
|
}
|
432
430
|
if (error == GRPC_ERROR_NONE) {
|
433
431
|
gpr_log(GPR_INFO, "Failed to connect to channel, retrying");
|
434
|
-
c->
|
435
|
-
gpr_backoff_step(&c->backoff_state, gpr_now(GPR_CLOCK_MONOTONIC));
|
432
|
+
c->backoff_result = grpc_backoff_step(exec_ctx, &c->backoff_state);
|
436
433
|
continue_connect_locked(exec_ctx, c);
|
437
434
|
gpr_mu_unlock(&c->mu);
|
438
435
|
} else {
|
@@ -442,8 +439,8 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|
442
439
|
GRPC_ERROR_UNREF(error);
|
443
440
|
}
|
444
441
|
|
445
|
-
static void maybe_start_connecting_locked(grpc_exec_ctx
|
446
|
-
grpc_subchannel
|
442
|
+
static void maybe_start_connecting_locked(grpc_exec_ctx* exec_ctx,
|
443
|
+
grpc_subchannel* c) {
|
447
444
|
if (c->disconnected) {
|
448
445
|
/* Don't try to connect if we're already disconnected */
|
449
446
|
return;
|
@@ -454,7 +451,7 @@ static void maybe_start_connecting_locked(grpc_exec_ctx *exec_ctx,
|
|
454
451
|
return;
|
455
452
|
}
|
456
453
|
|
457
|
-
if (GET_CONNECTED_SUBCHANNEL(c, no_barrier) !=
|
454
|
+
if (GET_CONNECTED_SUBCHANNEL(c, no_barrier) != nullptr) {
|
458
455
|
/* Already connected: don't restart */
|
459
456
|
return;
|
460
457
|
}
|
@@ -467,51 +464,50 @@ static void maybe_start_connecting_locked(grpc_exec_ctx *exec_ctx,
|
|
467
464
|
c->connecting = true;
|
468
465
|
GRPC_SUBCHANNEL_WEAK_REF(c, "connecting");
|
469
466
|
|
470
|
-
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
471
467
|
if (!c->backoff_begun) {
|
472
468
|
c->backoff_begun = true;
|
473
|
-
c->
|
469
|
+
c->backoff_result = grpc_backoff_begin(exec_ctx, &c->backoff_state);
|
474
470
|
continue_connect_locked(exec_ctx, c);
|
475
471
|
} else {
|
476
472
|
GPR_ASSERT(!c->have_alarm);
|
477
473
|
c->have_alarm = true;
|
478
|
-
|
479
|
-
|
480
|
-
|
474
|
+
const grpc_millis time_til_next =
|
475
|
+
c->backoff_result.next_attempt_start_time - grpc_exec_ctx_now(exec_ctx);
|
476
|
+
if (time_til_next <= 0) {
|
481
477
|
gpr_log(GPR_INFO, "Retry immediately");
|
482
478
|
} else {
|
483
|
-
gpr_log(GPR_INFO, "Retry in %"
|
484
|
-
time_til_next.tv_sec, time_til_next.tv_nsec);
|
479
|
+
gpr_log(GPR_INFO, "Retry in %" PRIdPTR " milliseconds", time_til_next);
|
485
480
|
}
|
486
481
|
GRPC_CLOSURE_INIT(&c->on_alarm, on_alarm, c, grpc_schedule_on_exec_ctx);
|
487
|
-
grpc_timer_init(exec_ctx, &c->alarm,
|
482
|
+
grpc_timer_init(exec_ctx, &c->alarm,
|
483
|
+
c->backoff_result.next_attempt_start_time, &c->on_alarm);
|
488
484
|
}
|
489
485
|
}
|
490
486
|
|
491
487
|
void grpc_subchannel_notify_on_state_change(
|
492
|
-
grpc_exec_ctx
|
493
|
-
grpc_pollset_set
|
494
|
-
grpc_closure
|
495
|
-
external_state_watcher
|
488
|
+
grpc_exec_ctx* exec_ctx, grpc_subchannel* c,
|
489
|
+
grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
|
490
|
+
grpc_closure* notify) {
|
491
|
+
external_state_watcher* w;
|
496
492
|
|
497
|
-
if (state ==
|
493
|
+
if (state == nullptr) {
|
498
494
|
gpr_mu_lock(&c->mu);
|
499
495
|
for (w = c->root_external_state_watcher.next;
|
500
496
|
w != &c->root_external_state_watcher; w = w->next) {
|
501
497
|
if (w->notify == notify) {
|
502
498
|
grpc_connectivity_state_notify_on_state_change(
|
503
|
-
exec_ctx, &c->state_tracker,
|
499
|
+
exec_ctx, &c->state_tracker, nullptr, &w->closure);
|
504
500
|
}
|
505
501
|
}
|
506
502
|
gpr_mu_unlock(&c->mu);
|
507
503
|
} else {
|
508
|
-
w = (external_state_watcher
|
504
|
+
w = (external_state_watcher*)gpr_malloc(sizeof(*w));
|
509
505
|
w->subchannel = c;
|
510
506
|
w->pollset_set = interested_parties;
|
511
507
|
w->notify = notify;
|
512
508
|
GRPC_CLOSURE_INIT(&w->closure, on_external_state_watcher_done, w,
|
513
509
|
grpc_schedule_on_exec_ctx);
|
514
|
-
if (interested_parties !=
|
510
|
+
if (interested_parties != nullptr) {
|
515
511
|
grpc_pollset_set_add_pollset_set(exec_ctx, c->pollset_set,
|
516
512
|
interested_parties);
|
517
513
|
}
|
@@ -528,18 +524,18 @@ void grpc_subchannel_notify_on_state_change(
|
|
528
524
|
}
|
529
525
|
|
530
526
|
void grpc_connected_subchannel_process_transport_op(
|
531
|
-
grpc_exec_ctx
|
532
|
-
grpc_transport_op
|
533
|
-
grpc_channel_stack
|
534
|
-
grpc_channel_element
|
527
|
+
grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
|
528
|
+
grpc_transport_op* op) {
|
529
|
+
grpc_channel_stack* channel_stack = CHANNEL_STACK_FROM_CONNECTION(con);
|
530
|
+
grpc_channel_element* top_elem = grpc_channel_stack_element(channel_stack, 0);
|
535
531
|
top_elem->filter->start_transport_op(exec_ctx, top_elem, op);
|
536
532
|
}
|
537
533
|
|
538
|
-
static void subchannel_on_child_state_changed(grpc_exec_ctx
|
539
|
-
grpc_error
|
540
|
-
state_watcher
|
541
|
-
grpc_subchannel
|
542
|
-
gpr_mu
|
534
|
+
static void subchannel_on_child_state_changed(grpc_exec_ctx* exec_ctx, void* p,
|
535
|
+
grpc_error* error) {
|
536
|
+
state_watcher* sw = (state_watcher*)p;
|
537
|
+
grpc_subchannel* c = sw->subchannel;
|
538
|
+
gpr_mu* mu = &c->mu;
|
543
539
|
|
544
540
|
gpr_mu_lock(mu);
|
545
541
|
|
@@ -553,10 +549,10 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
|
|
553
549
|
"reflect_child");
|
554
550
|
if (sw->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
|
555
551
|
grpc_connected_subchannel_notify_on_state_change(
|
556
|
-
exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier),
|
552
|
+
exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), nullptr,
|
557
553
|
&sw->connectivity_state, &sw->closure);
|
558
554
|
GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
|
559
|
-
sw =
|
555
|
+
sw = nullptr;
|
560
556
|
}
|
561
557
|
|
562
558
|
gpr_mu_unlock(mu);
|
@@ -564,13 +560,13 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
|
|
564
560
|
gpr_free(sw);
|
565
561
|
}
|
566
562
|
|
567
|
-
static void connected_subchannel_state_op(grpc_exec_ctx
|
568
|
-
grpc_connected_subchannel
|
569
|
-
grpc_pollset_set
|
570
|
-
grpc_connectivity_state
|
571
|
-
grpc_closure
|
572
|
-
grpc_transport_op
|
573
|
-
grpc_channel_element
|
563
|
+
static void connected_subchannel_state_op(grpc_exec_ctx* exec_ctx,
|
564
|
+
grpc_connected_subchannel* con,
|
565
|
+
grpc_pollset_set* interested_parties,
|
566
|
+
grpc_connectivity_state* state,
|
567
|
+
grpc_closure* closure) {
|
568
|
+
grpc_transport_op* op = grpc_make_transport_op(nullptr);
|
569
|
+
grpc_channel_element* elem;
|
574
570
|
op->connectivity_state = state;
|
575
571
|
op->on_connectivity_state_change = closure;
|
576
572
|
op->bind_pollset_set = interested_parties;
|
@@ -579,31 +575,31 @@ static void connected_subchannel_state_op(grpc_exec_ctx *exec_ctx,
|
|
579
575
|
}
|
580
576
|
|
581
577
|
void grpc_connected_subchannel_notify_on_state_change(
|
582
|
-
grpc_exec_ctx
|
583
|
-
grpc_pollset_set
|
584
|
-
grpc_closure
|
578
|
+
grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
|
579
|
+
grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
|
580
|
+
grpc_closure* closure) {
|
585
581
|
connected_subchannel_state_op(exec_ctx, con, interested_parties, state,
|
586
582
|
closure);
|
587
583
|
}
|
588
584
|
|
589
|
-
void grpc_connected_subchannel_ping(grpc_exec_ctx
|
590
|
-
grpc_connected_subchannel
|
591
|
-
grpc_closure
|
592
|
-
grpc_transport_op
|
593
|
-
grpc_channel_element
|
585
|
+
void grpc_connected_subchannel_ping(grpc_exec_ctx* exec_ctx,
|
586
|
+
grpc_connected_subchannel* con,
|
587
|
+
grpc_closure* closure) {
|
588
|
+
grpc_transport_op* op = grpc_make_transport_op(nullptr);
|
589
|
+
grpc_channel_element* elem;
|
594
590
|
op->send_ping = closure;
|
595
591
|
elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CONNECTION(con), 0);
|
596
592
|
elem->filter->start_transport_op(exec_ctx, elem, op);
|
597
593
|
}
|
598
594
|
|
599
|
-
static bool publish_transport_locked(grpc_exec_ctx
|
600
|
-
grpc_subchannel
|
601
|
-
grpc_connected_subchannel
|
602
|
-
grpc_channel_stack
|
603
|
-
state_watcher
|
595
|
+
static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
|
596
|
+
grpc_subchannel* c) {
|
597
|
+
grpc_connected_subchannel* con;
|
598
|
+
grpc_channel_stack* stk;
|
599
|
+
state_watcher* sw_subchannel;
|
604
600
|
|
605
601
|
/* construct channel stack */
|
606
|
-
grpc_channel_stack_builder
|
602
|
+
grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
|
607
603
|
grpc_channel_stack_builder_set_channel_arguments(
|
608
604
|
exec_ctx, builder, c->connecting_result.channel_args);
|
609
605
|
grpc_channel_stack_builder_set_transport(builder,
|
@@ -614,8 +610,8 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
614
610
|
grpc_channel_stack_builder_destroy(exec_ctx, builder);
|
615
611
|
return false;
|
616
612
|
}
|
617
|
-
grpc_error
|
618
|
-
exec_ctx, builder, 0, 1, connection_destroy,
|
613
|
+
grpc_error* error = grpc_channel_stack_builder_finish(
|
614
|
+
exec_ctx, builder, 0, 1, connection_destroy, nullptr, (void**)&con);
|
619
615
|
if (error != GRPC_ERROR_NONE) {
|
620
616
|
grpc_transport_destroy(exec_ctx, c->connecting_result.transport);
|
621
617
|
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
|
@@ -627,7 +623,7 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
627
623
|
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
|
628
624
|
|
629
625
|
/* initialize state watcher */
|
630
|
-
sw_subchannel = (state_watcher
|
626
|
+
sw_subchannel = (state_watcher*)gpr_malloc(sizeof(*sw_subchannel));
|
631
627
|
sw_subchannel->subchannel = c;
|
632
628
|
sw_subchannel->connectivity_state = GRPC_CHANNEL_READY;
|
633
629
|
GRPC_CLOSURE_INIT(&sw_subchannel->closure, subchannel_on_child_state_changed,
|
@@ -662,15 +658,15 @@ static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
662
658
|
return true;
|
663
659
|
}
|
664
660
|
|
665
|
-
static void subchannel_connected(grpc_exec_ctx
|
666
|
-
grpc_error
|
667
|
-
grpc_subchannel
|
668
|
-
grpc_channel_args
|
661
|
+
static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
|
662
|
+
grpc_error* error) {
|
663
|
+
grpc_subchannel* c = (grpc_subchannel*)arg;
|
664
|
+
grpc_channel_args* delete_channel_args = c->connecting_result.channel_args;
|
669
665
|
|
670
666
|
GRPC_SUBCHANNEL_WEAK_REF(c, "connected");
|
671
667
|
gpr_mu_lock(&c->mu);
|
672
668
|
c->connecting = false;
|
673
|
-
if (c->connecting_result.transport !=
|
669
|
+
if (c->connecting_result.transport != nullptr &&
|
674
670
|
publish_transport_locked(exec_ctx, c)) {
|
675
671
|
/* do nothing, transport was published */
|
676
672
|
} else if (c->disconnected) {
|
@@ -683,7 +679,7 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
|
683
679
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE),
|
684
680
|
"connect_failed");
|
685
681
|
|
686
|
-
const char
|
682
|
+
const char* errmsg = grpc_error_string(error);
|
687
683
|
gpr_log(GPR_INFO, "Connect failed: %s", errmsg);
|
688
684
|
|
689
685
|
maybe_start_connecting_locked(exec_ctx, c);
|
@@ -698,79 +694,80 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
|
698
694
|
* grpc_subchannel_call implementation
|
699
695
|
*/
|
700
696
|
|
701
|
-
static void subchannel_call_destroy(grpc_exec_ctx
|
702
|
-
grpc_error
|
703
|
-
grpc_subchannel_call
|
704
|
-
GPR_ASSERT(c->schedule_closure_after_destroy !=
|
697
|
+
static void subchannel_call_destroy(grpc_exec_ctx* exec_ctx, void* call,
|
698
|
+
grpc_error* error) {
|
699
|
+
grpc_subchannel_call* c = (grpc_subchannel_call*)call;
|
700
|
+
GPR_ASSERT(c->schedule_closure_after_destroy != nullptr);
|
705
701
|
GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
|
706
|
-
grpc_connected_subchannel
|
707
|
-
grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c),
|
702
|
+
grpc_connected_subchannel* connection = c->connection;
|
703
|
+
grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), nullptr,
|
708
704
|
c->schedule_closure_after_destroy);
|
709
705
|
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, connection, "subchannel_call");
|
710
706
|
GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
|
711
707
|
}
|
712
708
|
|
713
|
-
void grpc_subchannel_call_set_cleanup_closure(grpc_subchannel_call
|
714
|
-
grpc_closure
|
715
|
-
GPR_ASSERT(call->schedule_closure_after_destroy ==
|
716
|
-
GPR_ASSERT(closure !=
|
709
|
+
void grpc_subchannel_call_set_cleanup_closure(grpc_subchannel_call* call,
|
710
|
+
grpc_closure* closure) {
|
711
|
+
GPR_ASSERT(call->schedule_closure_after_destroy == nullptr);
|
712
|
+
GPR_ASSERT(closure != nullptr);
|
717
713
|
call->schedule_closure_after_destroy = closure;
|
718
714
|
}
|
719
715
|
|
720
716
|
void grpc_subchannel_call_ref(
|
721
|
-
grpc_subchannel_call
|
717
|
+
grpc_subchannel_call* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
722
718
|
GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
|
723
719
|
}
|
724
720
|
|
725
|
-
void grpc_subchannel_call_unref(grpc_exec_ctx
|
726
|
-
grpc_subchannel_call
|
721
|
+
void grpc_subchannel_call_unref(grpc_exec_ctx* exec_ctx,
|
722
|
+
grpc_subchannel_call* c
|
727
723
|
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
728
724
|
GRPC_CALL_STACK_UNREF(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
|
729
725
|
}
|
730
726
|
|
731
|
-
void grpc_subchannel_call_process_op(grpc_exec_ctx
|
732
|
-
grpc_subchannel_call
|
733
|
-
grpc_transport_stream_op_batch
|
727
|
+
void grpc_subchannel_call_process_op(grpc_exec_ctx* exec_ctx,
|
728
|
+
grpc_subchannel_call* call,
|
729
|
+
grpc_transport_stream_op_batch* batch) {
|
734
730
|
GPR_TIMER_BEGIN("grpc_subchannel_call_process_op", 0);
|
735
|
-
grpc_call_stack
|
736
|
-
grpc_call_element
|
731
|
+
grpc_call_stack* call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(call);
|
732
|
+
grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0);
|
737
733
|
GRPC_CALL_LOG_OP(GPR_INFO, top_elem, batch);
|
738
734
|
top_elem->filter->start_transport_stream_op_batch(exec_ctx, top_elem, batch);
|
739
735
|
GPR_TIMER_END("grpc_subchannel_call_process_op", 0);
|
740
736
|
}
|
741
737
|
|
742
|
-
grpc_connected_subchannel
|
743
|
-
grpc_subchannel
|
738
|
+
grpc_connected_subchannel* grpc_subchannel_get_connected_subchannel(
|
739
|
+
grpc_subchannel* c) {
|
744
740
|
return GET_CONNECTED_SUBCHANNEL(c, acq);
|
745
741
|
}
|
746
742
|
|
747
|
-
const grpc_subchannel_key
|
748
|
-
const grpc_subchannel
|
743
|
+
const grpc_subchannel_key* grpc_subchannel_get_key(
|
744
|
+
const grpc_subchannel* subchannel) {
|
749
745
|
return subchannel->key;
|
750
746
|
}
|
751
747
|
|
752
|
-
grpc_error
|
753
|
-
grpc_exec_ctx
|
754
|
-
const grpc_connected_subchannel_call_args
|
755
|
-
grpc_subchannel_call
|
756
|
-
grpc_channel_stack
|
757
|
-
*call = (grpc_subchannel_call
|
748
|
+
grpc_error* grpc_connected_subchannel_create_call(
|
749
|
+
grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
|
750
|
+
const grpc_connected_subchannel_call_args* args,
|
751
|
+
grpc_subchannel_call** call) {
|
752
|
+
grpc_channel_stack* chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
|
753
|
+
*call = (grpc_subchannel_call*)gpr_arena_alloc(
|
758
754
|
args->arena, sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
|
759
|
-
grpc_call_stack
|
755
|
+
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call);
|
760
756
|
(*call)->connection = GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
|
761
757
|
const grpc_call_element_args call_args = {
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
758
|
+
callstk, /* call_stack */
|
759
|
+
nullptr, /* server_transport_data */
|
760
|
+
args->context, /* context */
|
761
|
+
args->path, /* path */
|
762
|
+
args->start_time, /* start_time */
|
763
|
+
args->deadline, /* deadline */
|
764
|
+
args->arena, /* arena */
|
765
|
+
args->call_combiner /* call_combiner */
|
766
|
+
};
|
767
|
+
grpc_error* error = grpc_call_stack_init(
|
771
768
|
exec_ctx, chanstk, 1, subchannel_call_destroy, *call, &call_args);
|
772
769
|
if (error != GRPC_ERROR_NONE) {
|
773
|
-
const char
|
770
|
+
const char* error_string = grpc_error_string(error);
|
774
771
|
gpr_log(GPR_ERROR, "error: %s", error_string);
|
775
772
|
return error;
|
776
773
|
}
|
@@ -778,39 +775,39 @@ grpc_error *grpc_connected_subchannel_create_call(
|
|
778
775
|
return GRPC_ERROR_NONE;
|
779
776
|
}
|
780
777
|
|
781
|
-
grpc_call_stack
|
782
|
-
grpc_subchannel_call
|
778
|
+
grpc_call_stack* grpc_subchannel_call_get_call_stack(
|
779
|
+
grpc_subchannel_call* subchannel_call) {
|
783
780
|
return SUBCHANNEL_CALL_TO_CALL_STACK(subchannel_call);
|
784
781
|
}
|
785
782
|
|
786
|
-
static void grpc_uri_to_sockaddr(grpc_exec_ctx
|
787
|
-
grpc_resolved_address
|
788
|
-
grpc_uri
|
789
|
-
GPR_ASSERT(uri !=
|
783
|
+
static void grpc_uri_to_sockaddr(grpc_exec_ctx* exec_ctx, const char* uri_str,
|
784
|
+
grpc_resolved_address* addr) {
|
785
|
+
grpc_uri* uri = grpc_uri_parse(exec_ctx, uri_str, 0 /* suppress_errors */);
|
786
|
+
GPR_ASSERT(uri != nullptr);
|
790
787
|
if (!grpc_parse_uri(uri, addr)) memset(addr, 0, sizeof(*addr));
|
791
788
|
grpc_uri_destroy(uri);
|
792
789
|
}
|
793
790
|
|
794
|
-
void grpc_get_subchannel_address_arg(grpc_exec_ctx
|
795
|
-
const grpc_channel_args
|
796
|
-
grpc_resolved_address
|
797
|
-
const char
|
791
|
+
void grpc_get_subchannel_address_arg(grpc_exec_ctx* exec_ctx,
|
792
|
+
const grpc_channel_args* args,
|
793
|
+
grpc_resolved_address* addr) {
|
794
|
+
const char* addr_uri_str = grpc_get_subchannel_address_uri_arg(args);
|
798
795
|
memset(addr, 0, sizeof(*addr));
|
799
796
|
if (*addr_uri_str != '\0') {
|
800
797
|
grpc_uri_to_sockaddr(exec_ctx, addr_uri_str, addr);
|
801
798
|
}
|
802
799
|
}
|
803
800
|
|
804
|
-
const char
|
805
|
-
const grpc_arg
|
801
|
+
const char* grpc_get_subchannel_address_uri_arg(const grpc_channel_args* args) {
|
802
|
+
const grpc_arg* addr_arg =
|
806
803
|
grpc_channel_args_find(args, GRPC_ARG_SUBCHANNEL_ADDRESS);
|
807
|
-
GPR_ASSERT(addr_arg !=
|
804
|
+
GPR_ASSERT(addr_arg != nullptr); // Should have been set by LB policy.
|
808
805
|
GPR_ASSERT(addr_arg->type == GRPC_ARG_STRING);
|
809
806
|
return addr_arg->value.string;
|
810
807
|
}
|
811
808
|
|
812
|
-
grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address
|
809
|
+
grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address* addr) {
|
813
810
|
return grpc_channel_arg_string_create(
|
814
|
-
(char
|
811
|
+
(char*)GRPC_ARG_SUBCHANNEL_ADDRESS,
|
815
812
|
addr->len > 0 ? grpc_sockaddr_to_uri(addr) : gpr_strdup(""));
|
816
813
|
}
|