grpc 1.8.7 → 1.9.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +549 -325
- data/include/grpc/impl/codegen/grpc_types.h +1 -2
- data/include/grpc/impl/codegen/port_platform.h +46 -5
- data/include/grpc/impl/codegen/slice.h +1 -2
- data/include/grpc/module.modulemap +0 -2
- data/include/grpc/slice_buffer.h +1 -2
- data/include/grpc/support/log.h +4 -2
- data/include/grpc/support/thd.h +4 -1
- data/include/grpc/support/tls.h +6 -0
- data/include/grpc/support/tls_gcc.h +5 -40
- data/include/grpc/support/tls_msvc.h +9 -0
- data/include/grpc/support/tls_pthread.h +9 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +32 -29
- data/src/core/ext/filters/client_channel/backup_poller.h +2 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +26 -32
- data/src/core/ext/filters/client_channel/client_channel.cc +325 -356
- data/src/core/ext/filters/client_channel/client_channel.h +4 -12
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +9 -14
- data/src/core/ext/filters/client_channel/client_channel_factory.h +7 -20
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +7 -10
- data/src/core/ext/filters/client_channel/connector.cc +6 -7
- data/src/core/ext/filters/client_channel/connector.h +6 -16
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +38 -50
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +0 -8
- data/src/core/ext/filters/client_channel/http_proxy.cc +9 -13
- data/src/core/ext/filters/client_channel/http_proxy.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy.cc +72 -94
- data/src/core/ext/filters/client_channel/lb_policy.h +83 -92
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +474 -591
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +2 -10
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +6 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +0 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +0 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +9 -12
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +160 -182
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +182 -221
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +24 -35
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -20
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +6 -9
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -15
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -9
- data/src/core/ext/filters/client_channel/parse_address.cc +1 -1
- data/src/core/ext/filters/client_channel/parse_address.h +0 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +6 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.h +6 -16
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +13 -17
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +2 -12
- data/src/core/ext/filters/client_channel/resolver.cc +11 -13
- data/src/core/ext/filters/client_channel/resolver.h +14 -25
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +57 -70
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +23 -31
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +27 -45
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +9 -11
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +53 -66
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +25 -33
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -9
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +26 -35
- data/src/core/ext/filters/client_channel/resolver_factory.cc +2 -3
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -12
- data/src/core/ext/filters/client_channel/resolver_registry.cc +12 -15
- data/src/core/ext/filters/client_channel/resolver_registry.h +3 -12
- data/src/core/ext/filters/client_channel/retry_throttle.h +0 -8
- data/src/core/ext/filters/client_channel/subchannel.cc +289 -301
- data/src/core/ext/filters/client_channel/subchannel.h +57 -84
- data/src/core/ext/filters/client_channel/subchannel_index.cc +30 -33
- data/src/core/ext/filters/client_channel/subchannel_index.h +4 -16
- data/src/core/ext/filters/client_channel/uri_parser.cc +13 -17
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -10
- data/src/core/ext/filters/deadline/deadline_filter.cc +49 -67
- data/src/core/ext/filters/deadline/deadline_filter.h +4 -14
- data/src/core/ext/filters/http/client/http_client_filter.cc +60 -77
- data/src/core/ext/filters/http/client/http_client_filter.h +0 -8
- data/src/core/ext/filters/http/http_filters_plugin.cc +4 -6
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +63 -79
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +0 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +57 -71
- data/src/core/ext/filters/http/server/http_server_filter.h +0 -8
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +19 -24
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +0 -8
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +3 -3
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -8
- data/src/core/ext/filters/max_age/max_age_filter.cc +49 -62
- data/src/core/ext/filters/max_age/max_age_filter.h +0 -8
- data/src/core/ext/filters/message_size/message_size_filter.cc +23 -29
- data/src/core/ext/filters/message_size/message_size_filter.h +0 -8
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -18
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +0 -8
- data/src/core/ext/filters/workarounds/workaround_utils.h +0 -8
- data/src/core/ext/transport/chttp2/alpn/alpn.h +0 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +33 -40
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +0 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +15 -17
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +8 -8
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +23 -28
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +50 -57
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -10
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +3 -3
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -10
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -9
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -11
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -9
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +10 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +516 -636
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +4 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +29 -13
- data/src/core/ext/transport/chttp2/transport/flow_control.h +196 -53
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -8
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +31 -33
- data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -9
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +8 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -10
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -11
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +63 -81
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +230 -318
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +6 -19
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +14 -20
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -16
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +0 -7
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +0 -8
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +8 -11
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +4 -13
- data/src/core/ext/transport/chttp2/transport/internal.h +51 -75
- data/src/core/ext/transport/chttp2/transport/parsing.cc +83 -109
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -8
- data/src/core/ext/transport/chttp2/transport/varint.h +0 -8
- data/src/core/ext/transport/chttp2/transport/writing.cc +61 -65
- data/src/core/ext/transport/inproc/inproc_plugin.cc +2 -4
- data/src/core/ext/transport/inproc/inproc_transport.cc +177 -188
- data/src/core/ext/transport/inproc/inproc_transport.h +0 -8
- data/src/core/lib/backoff/backoff.cc +39 -44
- data/src/core/lib/backoff/backoff.h +61 -57
- data/src/core/lib/channel/channel_args.cc +8 -10
- data/src/core/lib/channel/channel_args.h +4 -13
- data/src/core/lib/channel/channel_stack.cc +19 -27
- data/src/core/lib/channel/channel_stack.h +27 -47
- data/src/core/lib/channel/channel_stack_builder.cc +11 -14
- data/src/core/lib/channel/channel_stack_builder.h +4 -15
- data/src/core/lib/channel/connected_channel.cc +23 -36
- data/src/core/lib/channel/connected_channel.h +1 -10
- data/src/core/lib/channel/handshaker.cc +31 -40
- data/src/core/lib/channel/handshaker.h +14 -25
- data/src/core/lib/channel/handshaker_factory.cc +6 -6
- data/src/core/lib/channel/handshaker_factory.h +5 -15
- data/src/core/lib/channel/handshaker_registry.cc +9 -13
- data/src/core/lib/channel/handshaker_registry.h +2 -11
- data/src/core/lib/compression/algorithm_metadata.h +0 -8
- data/src/core/lib/compression/message_compress.cc +19 -23
- data/src/core/lib/compression/message_compress.h +2 -12
- data/src/core/lib/compression/stream_compression.cc +1 -1
- data/src/core/lib/compression/stream_compression.h +0 -8
- data/src/core/lib/compression/stream_compression_gzip.cc +12 -11
- data/src/core/lib/compression/stream_compression_gzip.h +0 -8
- data/src/core/lib/compression/stream_compression_identity.h +0 -8
- data/src/core/lib/debug/stats.cc +4 -4
- data/src/core/lib/debug/stats.h +9 -19
- data/src/core/lib/debug/stats_data.cc +85 -116
- data/src/core/lib/debug/stats_data.h +236 -312
- data/src/core/lib/debug/trace.cc +1 -1
- data/src/core/lib/debug/trace.h +0 -12
- data/src/core/lib/{support → gpr++}/abstract.h +8 -3
- data/src/core/lib/{support → gpr++}/atomic.h +5 -5
- data/src/core/lib/{support → gpr++}/atomic_with_atm.h +3 -3
- data/src/core/lib/{support → gpr++}/atomic_with_std.h +3 -3
- data/src/core/lib/gpr++/debug_location.h +52 -0
- data/src/core/lib/gpr++/inlined_vector.h +112 -0
- data/src/core/lib/{support → gpr++}/manual_constructor.h +2 -2
- data/src/core/lib/{support → gpr++}/memory.h +3 -3
- data/src/core/lib/gpr++/orphanable.h +171 -0
- data/src/core/lib/gpr++/ref_counted.h +133 -0
- data/src/core/lib/gpr++/ref_counted_ptr.h +99 -0
- data/src/core/lib/{support → gpr}/alloc.cc +0 -0
- data/src/core/lib/{support → gpr}/arena.cc +1 -1
- data/src/core/lib/{support → gpr}/arena.h +3 -11
- data/src/core/lib/{support → gpr}/atm.cc +0 -0
- data/src/core/lib/{support → gpr}/avl.cc +0 -0
- data/src/core/lib/{support → gpr}/cmdline.cc +1 -1
- data/src/core/lib/{support → gpr}/cpu_iphone.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_linux.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/cpu_windows.cc +0 -0
- data/src/core/lib/{support → gpr}/env.h +3 -11
- data/src/core/lib/{support → gpr}/env_linux.cc +2 -2
- data/src/core/lib/{support → gpr}/env_posix.cc +4 -4
- data/src/core/lib/{support → gpr}/env_windows.cc +3 -3
- data/src/core/lib/{support → gpr}/fork.cc +3 -3
- data/src/core/lib/{support → gpr}/fork.h +3 -3
- data/src/core/lib/{support → gpr}/host_port.cc +1 -1
- data/src/core/lib/{support → gpr}/log.cc +3 -3
- data/src/core/lib/{support → gpr}/log_android.cc +3 -3
- data/src/core/lib/{support → gpr}/log_linux.cc +1 -1
- data/src/core/lib/{support → gpr}/log_posix.cc +5 -5
- data/src/core/lib/{support → gpr}/log_windows.cc +3 -3
- data/src/core/lib/{support → gpr}/mpscq.cc +1 -1
- data/src/core/lib/{support → gpr}/mpscq.h +3 -10
- data/src/core/lib/{support → gpr}/murmur_hash.cc +1 -1
- data/src/core/lib/{support → gpr}/murmur_hash.h +3 -11
- data/src/core/lib/{support → gpr}/spinlock.h +3 -3
- data/src/core/lib/{support → gpr}/string.cc +1 -1
- data/src/core/lib/{support → gpr}/string.h +3 -10
- data/src/core/lib/{support → gpr}/string_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/string_util_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/string_windows.cc +1 -1
- data/src/core/lib/{support → gpr}/string_windows.h +3 -11
- data/src/core/lib/{support → gpr}/subprocess_posix.cc +0 -0
- data/src/core/lib/{support → gpr}/subprocess_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/sync.cc +0 -0
- data/src/core/lib/{support → gpr}/sync_posix.cc +10 -1
- data/src/core/lib/{support → gpr}/sync_windows.cc +0 -0
- data/src/core/lib/{support → gpr}/thd.cc +0 -0
- data/src/core/lib/{support → gpr}/thd_internal.h +3 -3
- data/src/core/lib/{support → gpr}/thd_posix.cc +18 -2
- data/src/core/lib/{support → gpr}/thd_windows.cc +2 -1
- data/src/core/lib/{support → gpr}/time.cc +0 -0
- data/src/core/lib/{support → gpr}/time_posix.cc +2 -4
- data/src/core/lib/{support → gpr}/time_precise.cc +1 -1
- data/src/core/lib/{support → gpr}/time_precise.h +3 -11
- data/src/core/lib/{support → gpr}/time_windows.cc +1 -3
- data/src/core/lib/{support → gpr}/tls_pthread.cc +0 -0
- data/src/core/lib/{support → gpr}/tmpfile.h +3 -11
- data/src/core/lib/{support → gpr}/tmpfile_msys.cc +2 -2
- data/src/core/lib/{support → gpr}/tmpfile_posix.cc +2 -2
- data/src/core/lib/{support → gpr}/tmpfile_windows.cc +2 -2
- data/src/core/lib/{support → gpr}/wrap_memcpy.cc +0 -0
- data/src/core/lib/http/format_request.cc +1 -1
- data/src/core/lib/http/format_request.h +0 -8
- data/src/core/lib/http/httpcli.cc +55 -74
- data/src/core/lib/http/httpcli.h +13 -22
- data/src/core/lib/http/httpcli_security_connector.cc +27 -33
- data/src/core/lib/http/parser.h +0 -8
- data/src/core/lib/iomgr/block_annotate.h +10 -17
- data/src/core/lib/iomgr/call_combiner.cc +14 -17
- data/src/core/lib/iomgr/call_combiner.h +16 -34
- data/src/core/lib/iomgr/closure.h +24 -37
- data/src/core/lib/iomgr/combiner.cc +62 -66
- data/src/core/lib/iomgr/combiner.h +6 -16
- data/src/core/lib/iomgr/endpoint.cc +15 -21
- data/src/core/lib/iomgr/endpoint.h +16 -33
- data/src/core/lib/iomgr/endpoint_pair.h +0 -8
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +4 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +4 -6
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error.h +4 -9
- data/src/core/lib/iomgr/error_internal.h +0 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +110 -117
- data/src/core/lib/iomgr/ev_epoll1_linux.h +0 -8
- data/src/core/lib/iomgr/ev_epollex_linux.cc +111 -141
- data/src/core/lib/iomgr/ev_epollex_linux.h +0 -8
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +83 -109
- data/src/core/lib/iomgr/ev_epollsig_linux.h +2 -10
- data/src/core/lib/iomgr/ev_poll_posix.cc +103 -125
- data/src/core/lib/iomgr/ev_poll_posix.h +0 -8
- data/src/core/lib/iomgr/ev_posix.cc +35 -50
- data/src/core/lib/iomgr/ev_posix.h +27 -53
- data/src/core/lib/iomgr/exec_ctx.cc +46 -78
- data/src/core/lib/iomgr/exec_ctx.h +127 -60
- data/src/core/lib/iomgr/executor.cc +34 -38
- data/src/core/lib/iomgr/executor.h +3 -11
- data/src/core/lib/iomgr/fork_posix.cc +13 -12
- data/src/core/lib/iomgr/gethostname.h +0 -8
- data/src/core/lib/iomgr/gethostname_sysconf.cc +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +14 -16
- data/src/core/lib/iomgr/iocp_windows.h +1 -10
- data/src/core/lib/iomgr/iomgr.cc +60 -59
- data/src/core/lib/iomgr/iomgr.h +3 -12
- data/src/core/lib/iomgr/iomgr_internal.h +0 -8
- data/src/core/lib/iomgr/iomgr_uv.cc +2 -3
- data/src/core/lib/iomgr/iomgr_uv.h +0 -8
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -1
- data/src/core/lib/iomgr/load_file.cc +1 -1
- data/src/core/lib/iomgr/load_file.h +0 -8
- data/src/core/lib/iomgr/lockfree_event.cc +7 -8
- data/src/core/lib/iomgr/lockfree_event.h +3 -3
- data/src/core/lib/iomgr/polling_entity.cc +6 -10
- data/src/core/lib/iomgr/polling_entity.h +2 -11
- data/src/core/lib/iomgr/pollset.h +4 -13
- data/src/core/lib/iomgr/pollset_set.h +5 -18
- data/src/core/lib/iomgr/pollset_set_uv.cc +5 -10
- data/src/core/lib/iomgr/pollset_set_windows.cc +5 -10
- data/src/core/lib/iomgr/pollset_uv.cc +8 -9
- data/src/core/lib/iomgr/pollset_uv.h +0 -8
- data/src/core/lib/iomgr/pollset_windows.cc +14 -15
- data/src/core/lib/iomgr/pollset_windows.h +0 -8
- data/src/core/lib/iomgr/port.h +6 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -10
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -12
- data/src/core/lib/iomgr/resolve_address_uv.cc +7 -8
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -9
- data/src/core/lib/iomgr/resource_quota.cc +77 -107
- data/src/core/lib/iomgr/resource_quota.h +8 -25
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +0 -8
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.h +0 -8
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +1 -9
- data/src/core/lib/iomgr/socket_utils.h +0 -8
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +0 -8
- data/src/core/lib/iomgr/socket_windows.cc +8 -11
- data/src/core/lib/iomgr/socket_windows.h +3 -14
- data/src/core/lib/iomgr/tcp_client.h +1 -10
- data/src/core/lib/iomgr/tcp_client_posix.cc +94 -78
- data/src/core/lib/iomgr/tcp_client_posix.h +36 -8
- data/src/core/lib/iomgr/tcp_client_uv.cc +16 -23
- data/src/core/lib/iomgr/tcp_client_windows.cc +22 -25
- data/src/core/lib/iomgr/tcp_posix.cc +131 -153
- data/src/core/lib/iomgr/tcp_posix.h +3 -12
- data/src/core/lib/iomgr/tcp_server.h +6 -17
- data/src/core/lib/iomgr/tcp_server_posix.cc +31 -35
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_uv.cc +23 -34
- data/src/core/lib/iomgr/tcp_server_windows.cc +24 -34
- data/src/core/lib/iomgr/tcp_uv.cc +42 -56
- data/src/core/lib/iomgr/tcp_uv.h +0 -8
- data/src/core/lib/iomgr/tcp_windows.cc +43 -50
- data/src/core/lib/iomgr/tcp_windows.h +1 -9
- data/src/core/lib/iomgr/time_averaged_stats.h +0 -8
- data/src/core/lib/iomgr/timer.h +6 -15
- data/src/core/lib/iomgr/timer_generic.cc +22 -27
- data/src/core/lib/iomgr/timer_heap.h +0 -8
- data/src/core/lib/iomgr/timer_manager.cc +17 -19
- data/src/core/lib/iomgr/timer_manager.h +0 -8
- data/src/core/lib/iomgr/timer_uv.cc +12 -14
- data/src/core/lib/iomgr/udp_server.cc +148 -54
- data/src/core/lib/iomgr/udp_server.h +16 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +0 -8
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +4 -4
- data/src/core/lib/iomgr/wakeup_fd_cv.h +12 -20
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +0 -8
- data/src/core/lib/iomgr/wakeup_fd_posix.h +0 -8
- data/src/core/lib/json/json.h +0 -8
- data/src/core/lib/json/json_reader.h +0 -8
- data/src/core/lib/json/json_writer.h +0 -8
- data/src/core/lib/profiling/basic_timers.cc +3 -2
- data/src/core/lib/profiling/timers.h +0 -8
- data/src/core/lib/security/context/security_context.cc +9 -10
- data/src/core/lib/security/context/security_context.h +0 -8
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +23 -28
- data/src/core/lib/security/credentials/composite/composite_credentials.h +0 -8
- data/src/core/lib/security/credentials/credentials.cc +33 -42
- data/src/core/lib/security/credentials/credentials.h +24 -43
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +16 -22
- data/src/core/lib/security/credentials/fake/fake_credentials.h +0 -8
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +3 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +28 -34
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +0 -8
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +9 -13
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +0 -8
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +14 -20
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +1 -10
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +56 -72
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +5 -17
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +47 -55
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +3 -12
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +23 -28
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +8 -13
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -8
- data/src/core/lib/security/transport/auth_filters.h +0 -8
- data/src/core/lib/security/transport/client_auth_filter.cc +45 -54
- data/src/core/lib/security/transport/lb_targets_info.cc +2 -2
- data/src/core/lib/security/transport/lb_targets_info.h +0 -8
- data/src/core/lib/security/transport/secure_endpoint.cc +54 -68
- data/src/core/lib/security/transport/secure_endpoint.h +0 -8
- data/src/core/lib/security/transport/security_connector.cc +62 -86
- data/src/core/lib/security/transport/security_connector.h +22 -39
- data/src/core/lib/security/transport/security_handshaker.cc +83 -106
- data/src/core/lib/security/transport/security_handshaker.h +1 -10
- data/src/core/lib/security/transport/server_auth_filter.cc +31 -38
- data/src/core/lib/security/transport/tsi_error.h +0 -8
- data/src/core/lib/security/util/json_util.h +0 -8
- data/src/core/lib/slice/b64.cc +5 -6
- data/src/core/lib/slice/b64.h +3 -12
- data/src/core/lib/slice/percent_encoding.h +0 -8
- data/src/core/lib/slice/slice.cc +8 -9
- data/src/core/lib/slice/slice_buffer.cc +11 -16
- data/src/core/lib/slice/slice_hash_table.cc +5 -7
- data/src/core/lib/slice/slice_hash_table.h +2 -12
- data/src/core/lib/slice/slice_intern.cc +4 -5
- data/src/core/lib/slice/slice_internal.h +4 -15
- data/src/core/lib/slice/slice_string_helpers.cc +1 -1
- data/src/core/lib/slice/slice_string_helpers.h +1 -9
- data/src/core/lib/surface/alarm.cc +11 -14
- data/src/core/lib/surface/alarm_internal.h +0 -8
- data/src/core/lib/surface/byte_buffer.cc +2 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +7 -9
- data/src/core/lib/surface/call.cc +198 -241
- data/src/core/lib/surface/call.h +9 -23
- data/src/core/lib/surface/call_details.cc +3 -4
- data/src/core/lib/surface/call_log_batch.cc +1 -1
- data/src/core/lib/surface/call_test_only.h +0 -8
- data/src/core/lib/surface/channel.cc +53 -64
- data/src/core/lib/surface/channel.h +12 -23
- data/src/core/lib/surface/channel_init.cc +2 -3
- data/src/core/lib/surface/channel_init.h +2 -12
- data/src/core/lib/surface/channel_ping.cc +7 -9
- data/src/core/lib/surface/channel_stack_type.h +0 -8
- data/src/core/lib/surface/completion_queue.cc +158 -176
- data/src/core/lib/surface/completion_queue.h +9 -20
- data/src/core/lib/surface/completion_queue_factory.h +0 -8
- data/src/core/lib/surface/event_string.cc +1 -1
- data/src/core/lib/surface/event_string.h +0 -8
- data/src/core/lib/surface/init.cc +27 -25
- data/src/core/lib/surface/init.h +0 -8
- data/src/core/lib/surface/init_secure.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +30 -33
- data/src/core/lib/surface/lame_client.h +0 -8
- data/src/core/lib/surface/server.cc +151 -203
- data/src/core/lib/surface/server.h +7 -16
- data/src/core/lib/surface/validate_metadata.h +0 -8
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +1 -1
- data/src/core/lib/transport/byte_stream.cc +24 -38
- data/src/core/lib/transport/byte_stream.h +10 -25
- data/src/core/lib/transport/connectivity_state.cc +9 -13
- data/src/core/lib/transport/connectivity_state.h +4 -14
- data/src/core/lib/transport/error_utils.cc +6 -6
- data/src/core/lib/transport/error_utils.h +2 -11
- data/src/core/lib/transport/metadata.cc +21 -23
- data/src/core/lib/transport/metadata.h +8 -20
- data/src/core/lib/transport/metadata_batch.cc +34 -45
- data/src/core/lib/transport/metadata_batch.h +18 -32
- data/src/core/lib/transport/service_config.cc +11 -15
- data/src/core/lib/transport/service_config.h +3 -13
- data/src/core/lib/transport/static_metadata.cc +1 -1
- data/src/core/lib/transport/static_metadata.h +1 -7
- data/src/core/lib/transport/status_conversion.cc +2 -3
- data/src/core/lib/transport/status_conversion.h +1 -10
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -9
- data/src/core/lib/transport/transport.cc +36 -50
- data/src/core/lib/transport/transport.h +28 -30
- data/src/core/lib/transport/transport_impl.h +12 -23
- data/src/core/lib/transport/transport_op_string.cc +2 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +34 -34
- data/src/core/tsi/fake_transport_security.cc +7 -10
- data/src/core/tsi/fake_transport_security.h +0 -8
- data/src/core/tsi/gts_transport_security.cc +2 -2
- data/src/core/tsi/gts_transport_security.h +0 -8
- data/src/core/tsi/ssl_transport_security.cc +3 -0
- data/src/core/tsi/ssl_transport_security.h +0 -8
- data/src/core/tsi/ssl_types.h +0 -8
- data/src/core/tsi/transport_security.h +1 -9
- data/src/core/tsi/transport_security_adapter.h +0 -8
- data/src/core/tsi/transport_security_grpc.cc +11 -18
- data/src/core/tsi/transport_security_grpc.h +9 -21
- data/src/core/tsi/transport_security_interface.h +0 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -30
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -48
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +2 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -1
- data/src/ruby/spec/client_server_spec.rb +2 -2
- data/src/ruby/spec/generic/active_call_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_spec.rb +12 -12
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +3 -2
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +9 -9
- data/src/ruby/spec/support/helpers.rb +35 -1
- metadata +68 -66
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +0 -26
- data/include/grpc/support/histogram.h +0 -64
- data/src/core/lib/support/histogram.cc +0 -227
@@ -23,10 +23,6 @@
|
|
23
23
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
24
24
|
#include "src/core/lib/transport/http2_errors.h"
|
25
25
|
|
26
|
-
#ifdef __cplusplus
|
27
|
-
extern "C" {
|
28
|
-
#endif
|
29
|
-
|
30
26
|
/// A utility function to get the status code and message to be returned
|
31
27
|
/// to the application. If not set in the top-level message, looks
|
32
28
|
/// through child errors until it finds the first one with these attributes.
|
@@ -34,9 +30,8 @@ extern "C" {
|
|
34
30
|
/// be populated with the entire error string. If any of the attributes (code,
|
35
31
|
/// msg, http_status, error_string) are unneeded, they can be passed as
|
36
32
|
/// NULL.
|
37
|
-
void grpc_error_get_status(
|
38
|
-
|
39
|
-
grpc_slice* slice,
|
33
|
+
void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
|
34
|
+
grpc_status_code* code, grpc_slice* slice,
|
40
35
|
grpc_http2_error_code* http_status,
|
41
36
|
const char** error_string);
|
42
37
|
|
@@ -46,8 +41,4 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
|
|
46
41
|
/// GRPC_ERROR_CANCELLED
|
47
42
|
bool grpc_error_has_clear_grpc_status(grpc_error* error);
|
48
43
|
|
49
|
-
#ifdef __cplusplus
|
50
|
-
}
|
51
|
-
#endif
|
52
|
-
|
53
44
|
#endif /* GRPC_CORE_LIB_TRANSPORT_ERROR_UTILS_H */
|
@@ -31,12 +31,12 @@
|
|
31
31
|
#include <grpc/support/string_util.h>
|
32
32
|
#include <grpc/support/time.h>
|
33
33
|
|
34
|
+
#include "src/core/lib/gpr/murmur_hash.h"
|
35
|
+
#include "src/core/lib/gpr/string.h"
|
34
36
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
35
37
|
#include "src/core/lib/profiling/timers.h"
|
36
38
|
#include "src/core/lib/slice/slice_internal.h"
|
37
39
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
38
|
-
#include "src/core/lib/support/murmur_hash.h"
|
39
|
-
#include "src/core/lib/support/string.h"
|
40
40
|
#include "src/core/lib/transport/static_metadata.h"
|
41
41
|
|
42
42
|
/* There are two kinds of mdelem and mdstr instances.
|
@@ -108,7 +108,7 @@ typedef struct mdtab_shard {
|
|
108
108
|
|
109
109
|
static mdtab_shard g_shards[SHARD_COUNT];
|
110
110
|
|
111
|
-
static void gc_mdtab(
|
111
|
+
static void gc_mdtab(mdtab_shard* shard);
|
112
112
|
|
113
113
|
void grpc_mdctx_global_init(void) {
|
114
114
|
/* initialize shards */
|
@@ -123,11 +123,11 @@ void grpc_mdctx_global_init(void) {
|
|
123
123
|
}
|
124
124
|
}
|
125
125
|
|
126
|
-
void grpc_mdctx_global_shutdown(
|
126
|
+
void grpc_mdctx_global_shutdown() {
|
127
127
|
for (size_t i = 0; i < SHARD_COUNT; i++) {
|
128
128
|
mdtab_shard* shard = &g_shards[i];
|
129
129
|
gpr_mu_destroy(&shard->mu);
|
130
|
-
gc_mdtab(
|
130
|
+
gc_mdtab(shard);
|
131
131
|
/* TODO(ctiller): GPR_ASSERT(shard->count == 0); */
|
132
132
|
if (shard->count != 0) {
|
133
133
|
gpr_log(GPR_DEBUG, "WARNING: %" PRIuPTR " metadata elements were leaked",
|
@@ -165,7 +165,7 @@ static void ref_md_locked(mdtab_shard* shard,
|
|
165
165
|
}
|
166
166
|
}
|
167
167
|
|
168
|
-
static void gc_mdtab(
|
168
|
+
static void gc_mdtab(mdtab_shard* shard) {
|
169
169
|
size_t i;
|
170
170
|
interned_metadata** prev_next;
|
171
171
|
interned_metadata *md, *next;
|
@@ -178,8 +178,8 @@ static void gc_mdtab(grpc_exec_ctx* exec_ctx, mdtab_shard* shard) {
|
|
178
178
|
void* user_data = (void*)gpr_atm_no_barrier_load(&md->user_data);
|
179
179
|
next = md->bucket_next;
|
180
180
|
if (gpr_atm_acq_load(&md->refcnt) == 0) {
|
181
|
-
grpc_slice_unref_internal(
|
182
|
-
grpc_slice_unref_internal(
|
181
|
+
grpc_slice_unref_internal(md->key);
|
182
|
+
grpc_slice_unref_internal(md->value);
|
183
183
|
if (md->user_data) {
|
184
184
|
((destroy_user_data_func)gpr_atm_no_barrier_load(
|
185
185
|
&md->destroy_user_data))(user_data);
|
@@ -228,17 +228,17 @@ static void grow_mdtab(mdtab_shard* shard) {
|
|
228
228
|
GPR_TIMER_END("grow_mdtab", 0);
|
229
229
|
}
|
230
230
|
|
231
|
-
static void rehash_mdtab(
|
231
|
+
static void rehash_mdtab(mdtab_shard* shard) {
|
232
232
|
if (gpr_atm_no_barrier_load(&shard->free_estimate) >
|
233
233
|
(gpr_atm)(shard->capacity / 4)) {
|
234
|
-
gc_mdtab(
|
234
|
+
gc_mdtab(shard);
|
235
235
|
} else {
|
236
236
|
grow_mdtab(shard);
|
237
237
|
}
|
238
238
|
}
|
239
239
|
|
240
240
|
grpc_mdelem grpc_mdelem_create(
|
241
|
-
|
241
|
+
grpc_slice key, grpc_slice value,
|
242
242
|
grpc_mdelem_data* compatible_external_backing_store) {
|
243
243
|
if (!grpc_slice_is_interned(key) || !grpc_slice_is_interned(value)) {
|
244
244
|
if (compatible_external_backing_store != nullptr) {
|
@@ -318,7 +318,7 @@ grpc_mdelem grpc_mdelem_create(
|
|
318
318
|
shard->count++;
|
319
319
|
|
320
320
|
if (shard->count > shard->capacity * 2) {
|
321
|
-
rehash_mdtab(
|
321
|
+
rehash_mdtab(shard);
|
322
322
|
}
|
323
323
|
|
324
324
|
gpr_mu_unlock(&shard->mu);
|
@@ -328,22 +328,20 @@ grpc_mdelem grpc_mdelem_create(
|
|
328
328
|
return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED);
|
329
329
|
}
|
330
330
|
|
331
|
-
grpc_mdelem grpc_mdelem_from_slices(
|
332
|
-
|
333
|
-
|
334
|
-
grpc_slice_unref_internal(
|
335
|
-
grpc_slice_unref_internal(exec_ctx, value);
|
331
|
+
grpc_mdelem grpc_mdelem_from_slices(grpc_slice key, grpc_slice value) {
|
332
|
+
grpc_mdelem out = grpc_mdelem_create(key, value, nullptr);
|
333
|
+
grpc_slice_unref_internal(key);
|
334
|
+
grpc_slice_unref_internal(value);
|
336
335
|
return out;
|
337
336
|
}
|
338
337
|
|
339
|
-
grpc_mdelem grpc_mdelem_from_grpc_metadata(
|
340
|
-
grpc_metadata* metadata) {
|
338
|
+
grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata) {
|
341
339
|
bool changed = false;
|
342
340
|
grpc_slice key_slice =
|
343
341
|
grpc_slice_maybe_static_intern(metadata->key, &changed);
|
344
342
|
grpc_slice value_slice =
|
345
343
|
grpc_slice_maybe_static_intern(metadata->value, &changed);
|
346
|
-
return grpc_mdelem_create(
|
344
|
+
return grpc_mdelem_create(key_slice, value_slice,
|
347
345
|
changed ? nullptr : (grpc_mdelem_data*)metadata);
|
348
346
|
}
|
349
347
|
|
@@ -417,7 +415,7 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) {
|
|
417
415
|
return gmd;
|
418
416
|
}
|
419
417
|
|
420
|
-
void grpc_mdelem_unref(
|
418
|
+
void grpc_mdelem_unref(grpc_mdelem gmd DEBUG_ARGS) {
|
421
419
|
switch (GRPC_MDELEM_STORAGE(gmd)) {
|
422
420
|
case GRPC_MDELEM_STORAGE_EXTERNAL:
|
423
421
|
case GRPC_MDELEM_STORAGE_STATIC:
|
@@ -465,8 +463,8 @@ void grpc_mdelem_unref(grpc_exec_ctx* exec_ctx, grpc_mdelem gmd DEBUG_ARGS) {
|
|
465
463
|
const gpr_atm prev_refcount = gpr_atm_full_fetch_add(&md->refcnt, -1);
|
466
464
|
GPR_ASSERT(prev_refcount >= 1);
|
467
465
|
if (1 == prev_refcount) {
|
468
|
-
grpc_slice_unref_internal(
|
469
|
-
grpc_slice_unref_internal(
|
466
|
+
grpc_slice_unref_internal(md->key);
|
467
|
+
grpc_slice_unref_internal(md->value);
|
470
468
|
gpr_free(md);
|
471
469
|
}
|
472
470
|
break;
|
@@ -27,10 +27,6 @@
|
|
27
27
|
|
28
28
|
extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata;
|
29
29
|
|
30
|
-
#ifdef __cplusplus
|
31
|
-
extern "C" {
|
32
|
-
#endif
|
33
|
-
|
34
30
|
/* This file provides a mechanism for tracking metadata through the grpc stack.
|
35
31
|
It's not intended for consumption outside of the library.
|
36
32
|
|
@@ -111,20 +107,18 @@ struct grpc_mdelem {
|
|
111
107
|
(uintptr_t)GRPC_MDELEM_STORAGE_INTERNED_BIT))
|
112
108
|
|
113
109
|
/* Unrefs the slices. */
|
114
|
-
grpc_mdelem grpc_mdelem_from_slices(
|
115
|
-
grpc_slice value);
|
110
|
+
grpc_mdelem grpc_mdelem_from_slices(grpc_slice key, grpc_slice value);
|
116
111
|
|
117
112
|
/* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata
|
118
113
|
object as backing storage (so lifetimes should align) */
|
119
|
-
grpc_mdelem grpc_mdelem_from_grpc_metadata(
|
120
|
-
grpc_metadata* metadata);
|
114
|
+
grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata);
|
121
115
|
|
122
116
|
/* Does not unref the slices; if a new non-interned mdelem is needed, allocates
|
123
117
|
one if compatible_external_backing_store is NULL, or uses
|
124
118
|
compatible_external_backing_store if it is non-NULL (in which case it's the
|
125
119
|
users responsibility to ensure that it outlives usage) */
|
126
120
|
grpc_mdelem grpc_mdelem_create(
|
127
|
-
|
121
|
+
grpc_slice key, grpc_slice value,
|
128
122
|
grpc_mdelem_data* compatible_external_backing_store);
|
129
123
|
|
130
124
|
bool grpc_mdelem_eq(grpc_mdelem a, grpc_mdelem b);
|
@@ -140,16 +134,14 @@ void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*),
|
|
140
134
|
|
141
135
|
#ifndef NDEBUG
|
142
136
|
#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__)
|
143
|
-
#define GRPC_MDELEM_UNREF(
|
144
|
-
grpc_mdelem_unref((exec_ctx), (s), __FILE__, __LINE__)
|
137
|
+
#define GRPC_MDELEM_UNREF(s) grpc_mdelem_unref((s), __FILE__, __LINE__)
|
145
138
|
grpc_mdelem grpc_mdelem_ref(grpc_mdelem md, const char* file, int line);
|
146
|
-
void grpc_mdelem_unref(
|
147
|
-
const char* file, int line);
|
139
|
+
void grpc_mdelem_unref(grpc_mdelem md, const char* file, int line);
|
148
140
|
#else
|
149
141
|
#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s))
|
150
|
-
#define GRPC_MDELEM_UNREF(
|
142
|
+
#define GRPC_MDELEM_UNREF(s) grpc_mdelem_unref((s))
|
151
143
|
grpc_mdelem grpc_mdelem_ref(grpc_mdelem md);
|
152
|
-
void grpc_mdelem_unref(
|
144
|
+
void grpc_mdelem_unref(grpc_mdelem md);
|
153
145
|
#endif
|
154
146
|
|
155
147
|
#define GRPC_MDKEY(md) (GRPC_MDELEM_DATA(md)->key)
|
@@ -166,10 +158,6 @@ void grpc_mdelem_unref(grpc_exec_ctx* exec_ctx, grpc_mdelem md);
|
|
166
158
|
#define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash))
|
167
159
|
|
168
160
|
void grpc_mdctx_global_init(void);
|
169
|
-
void grpc_mdctx_global_shutdown(
|
170
|
-
|
171
|
-
#ifdef __cplusplus
|
172
|
-
}
|
173
|
-
#endif
|
161
|
+
void grpc_mdctx_global_shutdown();
|
174
162
|
|
175
163
|
#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */
|
@@ -51,8 +51,7 @@ static void assert_valid_list(grpc_mdelem_list* list) {
|
|
51
51
|
#endif /* NDEBUG */
|
52
52
|
}
|
53
53
|
|
54
|
-
static void assert_valid_callouts(
|
55
|
-
grpc_metadata_batch* batch) {
|
54
|
+
static void assert_valid_callouts(grpc_metadata_batch* batch) {
|
56
55
|
#ifndef NDEBUG
|
57
56
|
for (grpc_linked_mdelem* l = batch->list.head; l != nullptr; l = l->next) {
|
58
57
|
grpc_slice key_interned = grpc_slice_intern(GRPC_MDKEY(l->md));
|
@@ -61,7 +60,7 @@ static void assert_valid_callouts(grpc_exec_ctx* exec_ctx,
|
|
61
60
|
if (callout_idx != GRPC_BATCH_CALLOUTS_COUNT) {
|
62
61
|
GPR_ASSERT(batch->idx.array[callout_idx] == l);
|
63
62
|
}
|
64
|
-
grpc_slice_unref_internal(
|
63
|
+
grpc_slice_unref_internal(key_interned);
|
65
64
|
}
|
66
65
|
#endif
|
67
66
|
}
|
@@ -77,11 +76,10 @@ void grpc_metadata_batch_init(grpc_metadata_batch* batch) {
|
|
77
76
|
batch->deadline = GRPC_MILLIS_INF_FUTURE;
|
78
77
|
}
|
79
78
|
|
80
|
-
void grpc_metadata_batch_destroy(
|
81
|
-
grpc_metadata_batch* batch) {
|
79
|
+
void grpc_metadata_batch_destroy(grpc_metadata_batch* batch) {
|
82
80
|
grpc_linked_mdelem* l;
|
83
81
|
for (l = batch->list.head; l; l = l->next) {
|
84
|
-
GRPC_MDELEM_UNREF(
|
82
|
+
GRPC_MDELEM_UNREF(l->md);
|
85
83
|
}
|
86
84
|
}
|
87
85
|
|
@@ -126,13 +124,12 @@ static void maybe_unlink_callout(grpc_metadata_batch* batch,
|
|
126
124
|
batch->idx.array[idx] = nullptr;
|
127
125
|
}
|
128
126
|
|
129
|
-
grpc_error* grpc_metadata_batch_add_head(
|
130
|
-
grpc_metadata_batch* batch,
|
127
|
+
grpc_error* grpc_metadata_batch_add_head(grpc_metadata_batch* batch,
|
131
128
|
grpc_linked_mdelem* storage,
|
132
129
|
grpc_mdelem elem_to_add) {
|
133
130
|
GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
|
134
131
|
storage->md = elem_to_add;
|
135
|
-
return grpc_metadata_batch_link_head(
|
132
|
+
return grpc_metadata_batch_link_head(batch, storage);
|
136
133
|
}
|
137
134
|
|
138
135
|
static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
|
@@ -150,27 +147,25 @@ static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
|
|
150
147
|
assert_valid_list(list);
|
151
148
|
}
|
152
149
|
|
153
|
-
grpc_error* grpc_metadata_batch_link_head(
|
154
|
-
grpc_metadata_batch* batch,
|
150
|
+
grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
|
155
151
|
grpc_linked_mdelem* storage) {
|
156
|
-
assert_valid_callouts(
|
152
|
+
assert_valid_callouts(batch);
|
157
153
|
grpc_error* err = maybe_link_callout(batch, storage);
|
158
154
|
if (err != GRPC_ERROR_NONE) {
|
159
|
-
assert_valid_callouts(
|
155
|
+
assert_valid_callouts(batch);
|
160
156
|
return err;
|
161
157
|
}
|
162
158
|
link_head(&batch->list, storage);
|
163
|
-
assert_valid_callouts(
|
159
|
+
assert_valid_callouts(batch);
|
164
160
|
return GRPC_ERROR_NONE;
|
165
161
|
}
|
166
162
|
|
167
|
-
grpc_error* grpc_metadata_batch_add_tail(
|
168
|
-
grpc_metadata_batch* batch,
|
163
|
+
grpc_error* grpc_metadata_batch_add_tail(grpc_metadata_batch* batch,
|
169
164
|
grpc_linked_mdelem* storage,
|
170
165
|
grpc_mdelem elem_to_add) {
|
171
166
|
GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
|
172
167
|
storage->md = elem_to_add;
|
173
|
-
return grpc_metadata_batch_link_tail(
|
168
|
+
return grpc_metadata_batch_link_tail(batch, storage);
|
174
169
|
}
|
175
170
|
|
176
171
|
static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
|
@@ -189,17 +184,16 @@ static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
|
|
189
184
|
assert_valid_list(list);
|
190
185
|
}
|
191
186
|
|
192
|
-
grpc_error* grpc_metadata_batch_link_tail(
|
193
|
-
grpc_metadata_batch* batch,
|
187
|
+
grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
|
194
188
|
grpc_linked_mdelem* storage) {
|
195
|
-
assert_valid_callouts(
|
189
|
+
assert_valid_callouts(batch);
|
196
190
|
grpc_error* err = maybe_link_callout(batch, storage);
|
197
191
|
if (err != GRPC_ERROR_NONE) {
|
198
|
-
assert_valid_callouts(
|
192
|
+
assert_valid_callouts(batch);
|
199
193
|
return err;
|
200
194
|
}
|
201
195
|
link_tail(&batch->list, storage);
|
202
|
-
assert_valid_callouts(
|
196
|
+
assert_valid_callouts(batch);
|
203
197
|
return GRPC_ERROR_NONE;
|
204
198
|
}
|
205
199
|
|
@@ -220,31 +214,28 @@ static void unlink_storage(grpc_mdelem_list* list,
|
|
220
214
|
assert_valid_list(list);
|
221
215
|
}
|
222
216
|
|
223
|
-
void grpc_metadata_batch_remove(
|
224
|
-
grpc_metadata_batch* batch,
|
217
|
+
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
|
225
218
|
grpc_linked_mdelem* storage) {
|
226
|
-
assert_valid_callouts(
|
219
|
+
assert_valid_callouts(batch);
|
227
220
|
maybe_unlink_callout(batch, storage);
|
228
221
|
unlink_storage(&batch->list, storage);
|
229
|
-
GRPC_MDELEM_UNREF(
|
230
|
-
assert_valid_callouts(
|
222
|
+
GRPC_MDELEM_UNREF(storage->md);
|
223
|
+
assert_valid_callouts(batch);
|
231
224
|
}
|
232
225
|
|
233
|
-
void grpc_metadata_batch_set_value(
|
234
|
-
grpc_linked_mdelem* storage,
|
226
|
+
void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
|
235
227
|
grpc_slice value) {
|
236
228
|
grpc_mdelem old_mdelem = storage->md;
|
237
229
|
grpc_mdelem new_mdelem = grpc_mdelem_from_slices(
|
238
|
-
|
230
|
+
grpc_slice_ref_internal(GRPC_MDKEY(old_mdelem)), value);
|
239
231
|
storage->md = new_mdelem;
|
240
|
-
GRPC_MDELEM_UNREF(
|
232
|
+
GRPC_MDELEM_UNREF(old_mdelem);
|
241
233
|
}
|
242
234
|
|
243
|
-
grpc_error* grpc_metadata_batch_substitute(
|
244
|
-
grpc_metadata_batch* batch,
|
235
|
+
grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
|
245
236
|
grpc_linked_mdelem* storage,
|
246
237
|
grpc_mdelem new_mdelem) {
|
247
|
-
assert_valid_callouts(
|
238
|
+
assert_valid_callouts(batch);
|
248
239
|
grpc_error* error = GRPC_ERROR_NONE;
|
249
240
|
grpc_mdelem old_mdelem = storage->md;
|
250
241
|
if (!grpc_slice_eq(GRPC_MDKEY(new_mdelem), GRPC_MDKEY(old_mdelem))) {
|
@@ -253,19 +244,18 @@ grpc_error* grpc_metadata_batch_substitute(grpc_exec_ctx* exec_ctx,
|
|
253
244
|
error = maybe_link_callout(batch, storage);
|
254
245
|
if (error != GRPC_ERROR_NONE) {
|
255
246
|
unlink_storage(&batch->list, storage);
|
256
|
-
GRPC_MDELEM_UNREF(
|
247
|
+
GRPC_MDELEM_UNREF(storage->md);
|
257
248
|
}
|
258
249
|
} else {
|
259
250
|
storage->md = new_mdelem;
|
260
251
|
}
|
261
|
-
GRPC_MDELEM_UNREF(
|
262
|
-
assert_valid_callouts(
|
252
|
+
GRPC_MDELEM_UNREF(old_mdelem);
|
253
|
+
assert_valid_callouts(batch);
|
263
254
|
return error;
|
264
255
|
}
|
265
256
|
|
266
|
-
void grpc_metadata_batch_clear(
|
267
|
-
|
268
|
-
grpc_metadata_batch_destroy(exec_ctx, batch);
|
257
|
+
void grpc_metadata_batch_clear(grpc_metadata_batch* batch) {
|
258
|
+
grpc_metadata_batch_destroy(batch);
|
269
259
|
grpc_metadata_batch_init(batch);
|
270
260
|
}
|
271
261
|
|
@@ -292,8 +282,7 @@ static void add_error(grpc_error** composite, grpc_error* error,
|
|
292
282
|
*composite = grpc_error_add_child(*composite, error);
|
293
283
|
}
|
294
284
|
|
295
|
-
grpc_error* grpc_metadata_batch_filter(
|
296
|
-
grpc_metadata_batch* batch,
|
285
|
+
grpc_error* grpc_metadata_batch_filter(grpc_metadata_batch* batch,
|
297
286
|
grpc_metadata_batch_filter_func func,
|
298
287
|
void* user_data,
|
299
288
|
const char* composite_error_string) {
|
@@ -301,12 +290,12 @@ grpc_error* grpc_metadata_batch_filter(grpc_exec_ctx* exec_ctx,
|
|
301
290
|
grpc_error* error = GRPC_ERROR_NONE;
|
302
291
|
while (l) {
|
303
292
|
grpc_linked_mdelem* next = l->next;
|
304
|
-
grpc_filtered_mdelem new_mdelem = func(
|
293
|
+
grpc_filtered_mdelem new_mdelem = func(user_data, l->md);
|
305
294
|
add_error(&error, new_mdelem.error, composite_error_string);
|
306
295
|
if (GRPC_MDISNULL(new_mdelem.md)) {
|
307
|
-
grpc_metadata_batch_remove(
|
296
|
+
grpc_metadata_batch_remove(batch, l);
|
308
297
|
} else if (new_mdelem.md.payload != l->md.payload) {
|
309
|
-
grpc_metadata_batch_substitute(
|
298
|
+
grpc_metadata_batch_substitute(batch, l, new_mdelem.md);
|
310
299
|
}
|
311
300
|
l = next;
|
312
301
|
}
|
@@ -28,10 +28,6 @@
|
|
28
28
|
#include "src/core/lib/transport/metadata.h"
|
29
29
|
#include "src/core/lib/transport/static_metadata.h"
|
30
30
|
|
31
|
-
#ifdef __cplusplus
|
32
|
-
extern "C" {
|
33
|
-
#endif
|
34
|
-
|
35
31
|
typedef struct grpc_linked_mdelem {
|
36
32
|
grpc_mdelem md;
|
37
33
|
struct grpc_linked_mdelem* next;
|
@@ -57,28 +53,23 @@ typedef struct grpc_metadata_batch {
|
|
57
53
|
} grpc_metadata_batch;
|
58
54
|
|
59
55
|
void grpc_metadata_batch_init(grpc_metadata_batch* batch);
|
60
|
-
void grpc_metadata_batch_destroy(
|
61
|
-
|
62
|
-
void grpc_metadata_batch_clear(grpc_exec_ctx* exec_ctx,
|
63
|
-
grpc_metadata_batch* batch);
|
56
|
+
void grpc_metadata_batch_destroy(grpc_metadata_batch* batch);
|
57
|
+
void grpc_metadata_batch_clear(grpc_metadata_batch* batch);
|
64
58
|
bool grpc_metadata_batch_is_empty(grpc_metadata_batch* batch);
|
65
59
|
|
66
60
|
/* Returns the transport size of the batch. */
|
67
61
|
size_t grpc_metadata_batch_size(grpc_metadata_batch* batch);
|
68
62
|
|
69
63
|
/** Remove \a storage from the batch, unreffing the mdelem contained */
|
70
|
-
void grpc_metadata_batch_remove(
|
71
|
-
grpc_metadata_batch* batch,
|
64
|
+
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
|
72
65
|
grpc_linked_mdelem* storage);
|
73
66
|
|
74
67
|
/** Substitute a new mdelem for an old value */
|
75
|
-
grpc_error* grpc_metadata_batch_substitute(
|
76
|
-
grpc_metadata_batch* batch,
|
68
|
+
grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
|
77
69
|
grpc_linked_mdelem* storage,
|
78
70
|
grpc_mdelem new_value);
|
79
71
|
|
80
|
-
void grpc_metadata_batch_set_value(
|
81
|
-
grpc_linked_mdelem* storage,
|
72
|
+
void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
|
82
73
|
grpc_slice value);
|
83
74
|
|
84
75
|
/** Add \a storage to the beginning of \a batch. storage->md is
|
@@ -86,17 +77,17 @@ void grpc_metadata_batch_set_value(grpc_exec_ctx* exec_ctx,
|
|
86
77
|
\a storage is owned by the caller and must survive for the
|
87
78
|
lifetime of batch. This usually means it should be around
|
88
79
|
for the lifetime of the call. */
|
89
|
-
grpc_error* grpc_metadata_batch_link_head(
|
90
|
-
|
91
|
-
|
80
|
+
grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
|
81
|
+
grpc_linked_mdelem* storage)
|
82
|
+
GRPC_MUST_USE_RESULT;
|
92
83
|
/** Add \a storage to the end of \a batch. storage->md is
|
93
84
|
assumed to be valid.
|
94
85
|
\a storage is owned by the caller and must survive for the
|
95
86
|
lifetime of batch. This usually means it should be around
|
96
87
|
for the lifetime of the call. */
|
97
|
-
grpc_error* grpc_metadata_batch_link_tail(
|
98
|
-
|
99
|
-
|
88
|
+
grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
|
89
|
+
grpc_linked_mdelem* storage)
|
90
|
+
GRPC_MUST_USE_RESULT;
|
100
91
|
|
101
92
|
/** Add \a elem_to_add as the first element in \a batch, using
|
102
93
|
\a storage as backing storage for the linked list element.
|
@@ -105,8 +96,8 @@ grpc_error* grpc_metadata_batch_link_tail(
|
|
105
96
|
for the lifetime of the call.
|
106
97
|
Takes ownership of \a elem_to_add */
|
107
98
|
grpc_error* grpc_metadata_batch_add_head(
|
108
|
-
|
109
|
-
|
99
|
+
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
|
100
|
+
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
|
110
101
|
/** Add \a elem_to_add as the last element in \a batch, using
|
111
102
|
\a storage as backing storage for the linked list element.
|
112
103
|
\a storage is owned by the caller and must survive for the
|
@@ -114,8 +105,8 @@ grpc_error* grpc_metadata_batch_add_head(
|
|
114
105
|
for the lifetime of the call.
|
115
106
|
Takes ownership of \a elem_to_add */
|
116
107
|
grpc_error* grpc_metadata_batch_add_tail(
|
117
|
-
|
118
|
-
|
108
|
+
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
|
109
|
+
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
|
119
110
|
|
120
111
|
grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md);
|
121
112
|
|
@@ -132,11 +123,10 @@ typedef struct {
|
|
132
123
|
{ GRPC_ERROR_NONE, GRPC_MDNULL }
|
133
124
|
|
134
125
|
typedef grpc_filtered_mdelem (*grpc_metadata_batch_filter_func)(
|
135
|
-
|
126
|
+
void* user_data, grpc_mdelem elem);
|
136
127
|
grpc_error* grpc_metadata_batch_filter(
|
137
|
-
|
138
|
-
|
139
|
-
const char* composite_error_string) GRPC_MUST_USE_RESULT;
|
128
|
+
grpc_metadata_batch* batch, grpc_metadata_batch_filter_func func,
|
129
|
+
void* user_data, const char* composite_error_string) GRPC_MUST_USE_RESULT;
|
140
130
|
|
141
131
|
#ifndef NDEBUG
|
142
132
|
void grpc_metadata_batch_assert_ok(grpc_metadata_batch* comd);
|
@@ -146,8 +136,4 @@ void grpc_metadata_batch_assert_ok(grpc_metadata_batch* comd);
|
|
146
136
|
} while (0)
|
147
137
|
#endif
|
148
138
|
|
149
|
-
#ifdef __cplusplus
|
150
|
-
}
|
151
|
-
#endif
|
152
|
-
|
153
139
|
#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */
|