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
@@ -21,10 +21,6 @@
|
|
21
21
|
|
22
22
|
#include "src/core/lib/iomgr/endpoint.h"
|
23
23
|
|
24
|
-
#ifdef __cplusplus
|
25
|
-
extern "C" {
|
26
|
-
#endif
|
27
|
-
|
28
24
|
typedef struct {
|
29
25
|
grpc_endpoint* client;
|
30
26
|
grpc_endpoint* server;
|
@@ -33,8 +29,4 @@ typedef struct {
|
|
33
29
|
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
|
34
30
|
grpc_channel_args* args);
|
35
31
|
|
36
|
-
#ifdef __cplusplus
|
37
|
-
}
|
38
|
-
#endif
|
39
|
-
|
40
32
|
#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */
|
@@ -33,8 +33,8 @@
|
|
33
33
|
#include <grpc/support/alloc.h>
|
34
34
|
#include <grpc/support/log.h>
|
35
35
|
#include <grpc/support/string_util.h>
|
36
|
+
#include "src/core/lib/gpr/string.h"
|
36
37
|
#include "src/core/lib/iomgr/tcp_posix.h"
|
37
|
-
#include "src/core/lib/support/string.h"
|
38
38
|
|
39
39
|
static void create_sockets(int sv[2]) {
|
40
40
|
int flags;
|
@@ -54,18 +54,17 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
|
|
54
54
|
char* final_name;
|
55
55
|
create_sockets(sv);
|
56
56
|
|
57
|
-
|
57
|
+
grpc_core::ExecCtx exec_ctx;
|
58
58
|
|
59
59
|
gpr_asprintf(&final_name, "%s:client", name);
|
60
|
-
p.client = grpc_tcp_create(
|
60
|
+
p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name), args,
|
61
61
|
"socketpair-server");
|
62
62
|
gpr_free(final_name);
|
63
63
|
gpr_asprintf(&final_name, "%s:server", name);
|
64
|
-
p.server = grpc_tcp_create(
|
64
|
+
p.server = grpc_tcp_create(grpc_fd_create(sv[0], final_name), args,
|
65
65
|
"socketpair-client");
|
66
66
|
gpr_free(final_name);
|
67
67
|
|
68
|
-
grpc_exec_ctx_finish(&exec_ctx);
|
69
68
|
return p;
|
70
69
|
}
|
71
70
|
|
@@ -72,14 +72,12 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(
|
|
72
72
|
SOCKET sv[2];
|
73
73
|
grpc_endpoint_pair p;
|
74
74
|
create_sockets(sv);
|
75
|
-
|
76
|
-
p.client = grpc_tcp_create(
|
77
|
-
grpc_winsocket_create(sv[1], "endpoint:client"),
|
75
|
+
grpc_core::ExecCtx exec_ctx;
|
76
|
+
p.client = grpc_tcp_create(grpc_winsocket_create(sv[1], "endpoint:client"),
|
78
77
|
channel_args, "endpoint:server");
|
79
|
-
p.server = grpc_tcp_create(
|
80
|
-
grpc_winsocket_create(sv[0], "endpoint:server"),
|
78
|
+
p.server = grpc_tcp_create(grpc_winsocket_create(sv[0], "endpoint:server"),
|
81
79
|
channel_args, "endpoint:client");
|
82
|
-
|
80
|
+
|
83
81
|
return p;
|
84
82
|
}
|
85
83
|
|
data/src/core/lib/iomgr/error.cc
CHANGED
@@ -156,11 +156,7 @@ static void unref_errs(grpc_error* err) {
|
|
156
156
|
}
|
157
157
|
}
|
158
158
|
|
159
|
-
static void unref_slice(grpc_slice slice) {
|
160
|
-
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
161
|
-
grpc_slice_unref_internal(&exec_ctx, slice);
|
162
|
-
grpc_exec_ctx_finish(&exec_ctx);
|
163
|
-
}
|
159
|
+
static void unref_slice(grpc_slice slice) { grpc_slice_unref_internal(slice); }
|
164
160
|
|
165
161
|
static void unref_strs(grpc_error* err) {
|
166
162
|
for (size_t which = 0; which < GRPC_ERROR_STR_MAX; ++which) {
|
@@ -753,7 +749,7 @@ const char* grpc_error_string(grpc_error* err) {
|
|
753
749
|
|
754
750
|
if (!gpr_atm_rel_cas(&err->atomics.error_string, 0, (gpr_atm)out)) {
|
755
751
|
gpr_free(out);
|
756
|
-
out = (char*)
|
752
|
+
out = (char*)gpr_atm_acq_load(&err->atomics.error_string);
|
757
753
|
}
|
758
754
|
|
759
755
|
GPR_TIMER_END("grpc_error_string", 0);
|
data/src/core/lib/iomgr/error.h
CHANGED
@@ -29,10 +29,6 @@
|
|
29
29
|
|
30
30
|
#include "src/core/lib/debug/trace.h"
|
31
31
|
|
32
|
-
#ifdef __cplusplus
|
33
|
-
extern "C" {
|
34
|
-
#endif
|
35
|
-
|
36
32
|
/// Opaque representation of an error.
|
37
33
|
/// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a
|
38
34
|
/// full write up of this object.
|
@@ -169,6 +165,8 @@ void grpc_error_unref(grpc_error* err);
|
|
169
165
|
grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which,
|
170
166
|
intptr_t value) GRPC_MUST_USE_RESULT;
|
171
167
|
bool grpc_error_get_int(grpc_error* error, grpc_error_ints which, intptr_t* p);
|
168
|
+
/// This call takes ownership of the slice; the error is responsible for
|
169
|
+
/// eventually unref-ing it.
|
172
170
|
grpc_error* grpc_error_set_str(grpc_error* src, grpc_error_strs which,
|
173
171
|
grpc_slice str) GRPC_MUST_USE_RESULT;
|
174
172
|
/// Returns false if the specified string is not set.
|
@@ -178,7 +176,8 @@ bool grpc_error_get_str(grpc_error* error, grpc_error_strs which,
|
|
178
176
|
|
179
177
|
/// Add a child error: an error that is believed to have contributed to this
|
180
178
|
/// error occurring. Allows root causing high level errors from lower level
|
181
|
-
/// errors that contributed to them.
|
179
|
+
/// errors that contributed to them. The src error takes ownership of the
|
180
|
+
/// child error.
|
182
181
|
grpc_error* grpc_error_add_child(grpc_error* src,
|
183
182
|
grpc_error* child) GRPC_MUST_USE_RESULT;
|
184
183
|
grpc_error* grpc_os_error(const char* file, int line, int err,
|
@@ -203,8 +202,4 @@ bool grpc_log_if_error(const char* what, grpc_error* error, const char* file,
|
|
203
202
|
#define GRPC_LOG_IF_ERROR(what, error) \
|
204
203
|
grpc_log_if_error((what), (error), __FILE__, __LINE__)
|
205
204
|
|
206
|
-
#ifdef __cplusplus
|
207
|
-
}
|
208
|
-
#endif
|
209
|
-
|
210
205
|
#endif /* GRPC_CORE_LIB_IOMGR_ERROR_H */
|
@@ -25,10 +25,6 @@
|
|
25
25
|
#include <grpc/support/sync.h>
|
26
26
|
#include "src/core/lib/iomgr/error.h"
|
27
27
|
|
28
|
-
#ifdef __cplusplus
|
29
|
-
extern "C" {
|
30
|
-
#endif
|
31
|
-
|
32
28
|
typedef struct grpc_linked_error grpc_linked_error;
|
33
29
|
|
34
30
|
struct grpc_linked_error {
|
@@ -62,8 +58,4 @@ struct grpc_error {
|
|
62
58
|
|
63
59
|
bool grpc_error_is_special(struct grpc_error* err);
|
64
60
|
|
65
|
-
#ifdef __cplusplus
|
66
|
-
}
|
67
|
-
#endif
|
68
|
-
|
69
61
|
#endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */
|
@@ -20,12 +20,14 @@
|
|
20
20
|
|
21
21
|
#include <grpc/support/log.h>
|
22
22
|
|
23
|
-
/* This polling engine is only relevant on linux kernels supporting epoll
|
23
|
+
/* This polling engine is only relevant on linux kernels supporting epoll
|
24
|
+
epoll_create() or epoll_create1() */
|
24
25
|
#ifdef GRPC_LINUX_EPOLL
|
25
26
|
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
|
26
27
|
|
27
28
|
#include <assert.h>
|
28
29
|
#include <errno.h>
|
30
|
+
#include <fcntl.h>
|
29
31
|
#include <limits.h>
|
30
32
|
#include <poll.h>
|
31
33
|
#include <pthread.h>
|
@@ -41,14 +43,14 @@
|
|
41
43
|
#include <grpc/support/useful.h>
|
42
44
|
|
43
45
|
#include "src/core/lib/debug/stats.h"
|
46
|
+
#include "src/core/lib/gpr++/manual_constructor.h"
|
47
|
+
#include "src/core/lib/gpr/string.h"
|
44
48
|
#include "src/core/lib/iomgr/block_annotate.h"
|
45
49
|
#include "src/core/lib/iomgr/ev_posix.h"
|
46
50
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
47
51
|
#include "src/core/lib/iomgr/lockfree_event.h"
|
48
52
|
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
|
49
53
|
#include "src/core/lib/profiling/timers.h"
|
50
|
-
#include "src/core/lib/support/manual_constructor.h"
|
51
|
-
#include "src/core/lib/support/string.h"
|
52
54
|
|
53
55
|
static grpc_wakeup_fd global_wakeup_fd;
|
54
56
|
|
@@ -84,11 +86,28 @@ typedef struct epoll_set {
|
|
84
86
|
/* The global singleton epoll set */
|
85
87
|
static epoll_set g_epoll_set;
|
86
88
|
|
89
|
+
static int epoll_create_and_cloexec() {
|
90
|
+
#ifdef GRPC_LINUX_EPOLL_CREATE1
|
91
|
+
int fd = epoll_create1(EPOLL_CLOEXEC);
|
92
|
+
if (fd < 0) {
|
93
|
+
gpr_log(GPR_ERROR, "epoll_create1 unavailable");
|
94
|
+
}
|
95
|
+
#else
|
96
|
+
int fd = epoll_create(MAX_EPOLL_EVENTS);
|
97
|
+
if (fd < 0) {
|
98
|
+
gpr_log(GPR_ERROR, "epoll_create unavailable");
|
99
|
+
} else if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
|
100
|
+
gpr_log(GPR_ERROR, "fcntl following epoll_create failed");
|
101
|
+
return -1;
|
102
|
+
}
|
103
|
+
#endif
|
104
|
+
return fd;
|
105
|
+
}
|
106
|
+
|
87
107
|
/* Must be called *only* once */
|
88
108
|
static bool epoll_set_init() {
|
89
|
-
g_epoll_set.epfd =
|
109
|
+
g_epoll_set.epfd = epoll_create_and_cloexec();
|
90
110
|
if (g_epoll_set.epfd < 0) {
|
91
|
-
gpr_log(GPR_ERROR, "epoll unavailable");
|
92
111
|
return false;
|
93
112
|
}
|
94
113
|
|
@@ -299,31 +318,29 @@ static int fd_wrapped_fd(grpc_fd* fd) { return fd->fd; }
|
|
299
318
|
/* if 'releasing_fd' is true, it means that we are going to detach the internal
|
300
319
|
* fd from grpc_fd structure (i.e which means we should not be calling
|
301
320
|
* shutdown() syscall on that fd) */
|
302
|
-
static void fd_shutdown_internal(
|
303
|
-
|
304
|
-
if (fd->read_closure->SetShutdown(
|
321
|
+
static void fd_shutdown_internal(grpc_fd* fd, grpc_error* why,
|
322
|
+
bool releasing_fd) {
|
323
|
+
if (fd->read_closure->SetShutdown(GRPC_ERROR_REF(why))) {
|
305
324
|
if (!releasing_fd) {
|
306
325
|
shutdown(fd->fd, SHUT_RDWR);
|
307
326
|
}
|
308
|
-
fd->write_closure->SetShutdown(
|
327
|
+
fd->write_closure->SetShutdown(GRPC_ERROR_REF(why));
|
309
328
|
}
|
310
329
|
GRPC_ERROR_UNREF(why);
|
311
330
|
}
|
312
331
|
|
313
332
|
/* Might be called multiple times */
|
314
|
-
static void fd_shutdown(
|
315
|
-
fd_shutdown_internal(
|
333
|
+
static void fd_shutdown(grpc_fd* fd, grpc_error* why) {
|
334
|
+
fd_shutdown_internal(fd, why, false);
|
316
335
|
}
|
317
336
|
|
318
|
-
static void fd_orphan(
|
319
|
-
grpc_closure* on_done, int* release_fd,
|
337
|
+
static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
|
320
338
|
bool already_closed, const char* reason) {
|
321
339
|
grpc_error* error = GRPC_ERROR_NONE;
|
322
340
|
bool is_release_fd = (release_fd != nullptr);
|
323
341
|
|
324
342
|
if (!fd->read_closure->IsShutdown()) {
|
325
|
-
fd_shutdown_internal(
|
326
|
-
GRPC_ERROR_CREATE_FROM_COPIED_STRING(reason),
|
343
|
+
fd_shutdown_internal(fd, GRPC_ERROR_CREATE_FROM_COPIED_STRING(reason),
|
327
344
|
is_release_fd);
|
328
345
|
}
|
329
346
|
|
@@ -335,7 +352,7 @@ static void fd_orphan(grpc_exec_ctx* exec_ctx, grpc_fd* fd,
|
|
335
352
|
close(fd->fd);
|
336
353
|
}
|
337
354
|
|
338
|
-
GRPC_CLOSURE_SCHED(
|
355
|
+
GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_REF(error));
|
339
356
|
|
340
357
|
grpc_iomgr_unregister_object(&fd->iomgr_object);
|
341
358
|
fd->read_closure->DestroyEvent();
|
@@ -347,8 +364,7 @@ static void fd_orphan(grpc_exec_ctx* exec_ctx, grpc_fd* fd,
|
|
347
364
|
gpr_mu_unlock(&fd_freelist_mu);
|
348
365
|
}
|
349
366
|
|
350
|
-
static grpc_pollset* fd_get_read_notifier_pollset(
|
351
|
-
grpc_fd* fd) {
|
367
|
+
static grpc_pollset* fd_get_read_notifier_pollset(grpc_fd* fd) {
|
352
368
|
gpr_atm notifier = gpr_atm_acq_load(&fd->read_notifier_pollset);
|
353
369
|
return (grpc_pollset*)notifier;
|
354
370
|
}
|
@@ -357,26 +373,21 @@ static bool fd_is_shutdown(grpc_fd* fd) {
|
|
357
373
|
return fd->read_closure->IsShutdown();
|
358
374
|
}
|
359
375
|
|
360
|
-
static void fd_notify_on_read(
|
361
|
-
|
362
|
-
fd->read_closure->NotifyOn(exec_ctx, closure);
|
376
|
+
static void fd_notify_on_read(grpc_fd* fd, grpc_closure* closure) {
|
377
|
+
fd->read_closure->NotifyOn(closure);
|
363
378
|
}
|
364
379
|
|
365
|
-
static void fd_notify_on_write(
|
366
|
-
|
367
|
-
fd->write_closure->NotifyOn(exec_ctx, closure);
|
380
|
+
static void fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) {
|
381
|
+
fd->write_closure->NotifyOn(closure);
|
368
382
|
}
|
369
383
|
|
370
|
-
static void fd_become_readable(
|
371
|
-
|
372
|
-
fd->read_closure->SetReady(exec_ctx);
|
384
|
+
static void fd_become_readable(grpc_fd* fd, grpc_pollset* notifier) {
|
385
|
+
fd->read_closure->SetReady();
|
373
386
|
/* Use release store to match with acquire load in fd_get_read_notifier */
|
374
387
|
gpr_atm_rel_store(&fd->read_notifier_pollset, (gpr_atm)notifier);
|
375
388
|
}
|
376
389
|
|
377
|
-
static void fd_become_writable(
|
378
|
-
fd->write_closure->SetReady(exec_ctx);
|
379
|
-
}
|
390
|
+
static void fd_become_writable(grpc_fd* fd) { fd->write_closure->SetReady(); }
|
380
391
|
|
381
392
|
/*******************************************************************************
|
382
393
|
* Pollset Definitions
|
@@ -479,7 +490,7 @@ static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) {
|
|
479
490
|
pollset->next = pollset->prev = nullptr;
|
480
491
|
}
|
481
492
|
|
482
|
-
static void pollset_destroy(
|
493
|
+
static void pollset_destroy(grpc_pollset* pollset) {
|
483
494
|
gpr_mu_lock(&pollset->mu);
|
484
495
|
if (!pollset->seen_inactive) {
|
485
496
|
pollset_neighborhood* neighborhood = pollset->neighborhood;
|
@@ -507,27 +518,26 @@ static void pollset_destroy(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset) {
|
|
507
518
|
gpr_mu_destroy(&pollset->mu);
|
508
519
|
}
|
509
520
|
|
510
|
-
static grpc_error* pollset_kick_all(
|
511
|
-
grpc_pollset* pollset) {
|
521
|
+
static grpc_error* pollset_kick_all(grpc_pollset* pollset) {
|
512
522
|
GPR_TIMER_BEGIN("pollset_kick_all", 0);
|
513
523
|
grpc_error* error = GRPC_ERROR_NONE;
|
514
524
|
if (pollset->root_worker != nullptr) {
|
515
525
|
grpc_pollset_worker* worker = pollset->root_worker;
|
516
526
|
do {
|
517
|
-
GRPC_STATS_INC_POLLSET_KICK(
|
527
|
+
GRPC_STATS_INC_POLLSET_KICK();
|
518
528
|
switch (worker->state) {
|
519
529
|
case KICKED:
|
520
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(
|
530
|
+
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
521
531
|
break;
|
522
532
|
case UNKICKED:
|
523
533
|
SET_KICK_STATE(worker, KICKED);
|
524
534
|
if (worker->initialized_cv) {
|
525
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
535
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
526
536
|
gpr_cv_signal(&worker->cv);
|
527
537
|
}
|
528
538
|
break;
|
529
539
|
case DESIGNATED_POLLER:
|
530
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(
|
540
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
531
541
|
SET_KICK_STATE(worker, KICKED);
|
532
542
|
append_error(&error, grpc_wakeup_fd_wakeup(&global_wakeup_fd),
|
533
543
|
"pollset_kick_all");
|
@@ -543,32 +553,29 @@ static grpc_error* pollset_kick_all(grpc_exec_ctx* exec_ctx,
|
|
543
553
|
return error;
|
544
554
|
}
|
545
555
|
|
546
|
-
static void pollset_maybe_finish_shutdown(
|
547
|
-
grpc_pollset* pollset) {
|
556
|
+
static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
|
548
557
|
if (pollset->shutdown_closure != nullptr && pollset->root_worker == nullptr &&
|
549
558
|
pollset->begin_refs == 0) {
|
550
559
|
GPR_TIMER_MARK("pollset_finish_shutdown", 0);
|
551
|
-
GRPC_CLOSURE_SCHED(
|
560
|
+
GRPC_CLOSURE_SCHED(pollset->shutdown_closure, GRPC_ERROR_NONE);
|
552
561
|
pollset->shutdown_closure = nullptr;
|
553
562
|
}
|
554
563
|
}
|
555
564
|
|
556
|
-
static void pollset_shutdown(
|
557
|
-
grpc_closure* closure) {
|
565
|
+
static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
|
558
566
|
GPR_TIMER_BEGIN("pollset_shutdown", 0);
|
559
567
|
GPR_ASSERT(pollset->shutdown_closure == nullptr);
|
560
568
|
GPR_ASSERT(!pollset->shutting_down);
|
561
569
|
pollset->shutdown_closure = closure;
|
562
570
|
pollset->shutting_down = true;
|
563
|
-
GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(
|
564
|
-
pollset_maybe_finish_shutdown(
|
571
|
+
GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(pollset));
|
572
|
+
pollset_maybe_finish_shutdown(pollset);
|
565
573
|
GPR_TIMER_END("pollset_shutdown", 0);
|
566
574
|
}
|
567
575
|
|
568
|
-
static int poll_deadline_to_millis_timeout(
|
569
|
-
grpc_millis millis) {
|
576
|
+
static int poll_deadline_to_millis_timeout(grpc_millis millis) {
|
570
577
|
if (millis == GRPC_MILLIS_INF_FUTURE) return -1;
|
571
|
-
grpc_millis delta = millis -
|
578
|
+
grpc_millis delta = millis - grpc_core::ExecCtx::Get()->Now();
|
572
579
|
if (delta > INT_MAX) {
|
573
580
|
return INT_MAX;
|
574
581
|
} else if (delta < 0) {
|
@@ -586,8 +593,7 @@ static int poll_deadline_to_millis_timeout(grpc_exec_ctx* exec_ctx,
|
|
586
593
|
NOTE ON SYNCRHONIZATION: Similar to do_epoll_wait(), this function is only
|
587
594
|
called by g_active_poller thread. So there is no need for synchronization
|
588
595
|
when accessing fields in g_epoll_set */
|
589
|
-
static grpc_error* process_epoll_events(
|
590
|
-
grpc_pollset* pollset) {
|
596
|
+
static grpc_error* process_epoll_events(grpc_pollset* pollset) {
|
591
597
|
static const char* err_desc = "process_events";
|
592
598
|
grpc_error* error = GRPC_ERROR_NONE;
|
593
599
|
|
@@ -611,11 +617,11 @@ static grpc_error* process_epoll_events(grpc_exec_ctx* exec_ctx,
|
|
611
617
|
bool write_ev = (ev->events & EPOLLOUT) != 0;
|
612
618
|
|
613
619
|
if (read_ev || cancel) {
|
614
|
-
fd_become_readable(
|
620
|
+
fd_become_readable(fd, pollset);
|
615
621
|
}
|
616
622
|
|
617
623
|
if (write_ev || cancel) {
|
618
|
-
fd_become_writable(
|
624
|
+
fd_become_writable(fd);
|
619
625
|
}
|
620
626
|
}
|
621
627
|
}
|
@@ -631,27 +637,26 @@ static grpc_error* process_epoll_events(grpc_exec_ctx* exec_ctx,
|
|
631
637
|
NOTE ON SYNCHRONIZATION: At any point of time, only the g_active_poller
|
632
638
|
(i.e the designated poller thread) will be calling this function. So there is
|
633
639
|
no need for any synchronization when accesing fields in g_epoll_set */
|
634
|
-
static grpc_error* do_epoll_wait(
|
635
|
-
grpc_millis deadline) {
|
640
|
+
static grpc_error* do_epoll_wait(grpc_pollset* ps, grpc_millis deadline) {
|
636
641
|
GPR_TIMER_BEGIN("do_epoll_wait", 0);
|
637
642
|
|
638
643
|
int r;
|
639
|
-
int timeout = poll_deadline_to_millis_timeout(
|
644
|
+
int timeout = poll_deadline_to_millis_timeout(deadline);
|
640
645
|
if (timeout != 0) {
|
641
646
|
GRPC_SCHEDULING_START_BLOCKING_REGION;
|
642
647
|
}
|
643
648
|
do {
|
644
|
-
GRPC_STATS_INC_SYSCALL_POLL(
|
649
|
+
GRPC_STATS_INC_SYSCALL_POLL();
|
645
650
|
r = epoll_wait(g_epoll_set.epfd, g_epoll_set.events, MAX_EPOLL_EVENTS,
|
646
651
|
timeout);
|
647
652
|
} while (r < 0 && errno == EINTR);
|
648
653
|
if (timeout != 0) {
|
649
|
-
|
654
|
+
GRPC_SCHEDULING_END_BLOCKING_REGION;
|
650
655
|
}
|
651
656
|
|
652
657
|
if (r < 0) return GRPC_OS_ERROR(errno, "epoll_wait");
|
653
658
|
|
654
|
-
GRPC_STATS_INC_POLL_EVENTS_RETURNED(
|
659
|
+
GRPC_STATS_INC_POLL_EVENTS_RETURNED(r);
|
655
660
|
|
656
661
|
if (grpc_polling_trace.enabled()) {
|
657
662
|
gpr_log(GPR_DEBUG, "ps: %p poll got %d events", ps, r);
|
@@ -664,8 +669,7 @@ static grpc_error* do_epoll_wait(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
|
|
664
669
|
return GRPC_ERROR_NONE;
|
665
670
|
}
|
666
671
|
|
667
|
-
static bool begin_worker(
|
668
|
-
grpc_pollset_worker* worker,
|
672
|
+
static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
669
673
|
grpc_pollset_worker** worker_hdl,
|
670
674
|
grpc_millis deadline) {
|
671
675
|
GPR_TIMER_BEGIN("begin_worker", 0);
|
@@ -753,14 +757,14 @@ static bool begin_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
753
757
|
}
|
754
758
|
|
755
759
|
if (gpr_cv_wait(&worker->cv, &pollset->mu,
|
756
|
-
grpc_millis_to_timespec(deadline,
|
760
|
+
grpc_millis_to_timespec(deadline, GPR_CLOCK_MONOTONIC)) &&
|
757
761
|
worker->state == UNKICKED) {
|
758
762
|
/* If gpr_cv_wait returns true (i.e a timeout), pretend that the worker
|
759
763
|
received a kick */
|
760
764
|
SET_KICK_STATE(worker, KICKED);
|
761
765
|
}
|
762
766
|
}
|
763
|
-
|
767
|
+
grpc_core::ExecCtx::Get()->InvalidateNow();
|
764
768
|
}
|
765
769
|
|
766
770
|
if (grpc_polling_trace.enabled()) {
|
@@ -791,7 +795,7 @@ static bool begin_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
791
795
|
}
|
792
796
|
|
793
797
|
static bool check_neighborhood_for_available_poller(
|
794
|
-
|
798
|
+
pollset_neighborhood* neighborhood) {
|
795
799
|
GPR_TIMER_BEGIN("check_neighborhood_for_available_poller", 0);
|
796
800
|
bool found_worker = false;
|
797
801
|
do {
|
@@ -815,7 +819,7 @@ static bool check_neighborhood_for_available_poller(
|
|
815
819
|
SET_KICK_STATE(inspect_worker, DESIGNATED_POLLER);
|
816
820
|
if (inspect_worker->initialized_cv) {
|
817
821
|
GPR_TIMER_MARK("signal worker", 0);
|
818
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
822
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
819
823
|
gpr_cv_signal(&inspect_worker->cv);
|
820
824
|
}
|
821
825
|
} else {
|
@@ -855,8 +859,7 @@ static bool check_neighborhood_for_available_poller(
|
|
855
859
|
return found_worker;
|
856
860
|
}
|
857
861
|
|
858
|
-
static void end_worker(
|
859
|
-
grpc_pollset_worker* worker,
|
862
|
+
static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
860
863
|
grpc_pollset_worker** worker_hdl) {
|
861
864
|
GPR_TIMER_BEGIN("end_worker", 0);
|
862
865
|
if (grpc_polling_trace.enabled()) {
|
@@ -866,7 +869,7 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
866
869
|
/* Make sure we appear kicked */
|
867
870
|
SET_KICK_STATE(worker, KICKED);
|
868
871
|
grpc_closure_list_move(&worker->schedule_on_end_work,
|
869
|
-
|
872
|
+
grpc_core::ExecCtx::Get()->closure_list());
|
870
873
|
if (gpr_atm_no_barrier_load(&g_active_poller) == (gpr_atm)worker) {
|
871
874
|
if (worker->next != worker && worker->next->state == UNKICKED) {
|
872
875
|
if (grpc_polling_trace.enabled()) {
|
@@ -875,11 +878,11 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
875
878
|
GPR_ASSERT(worker->next->initialized_cv);
|
876
879
|
gpr_atm_no_barrier_store(&g_active_poller, (gpr_atm)worker->next);
|
877
880
|
SET_KICK_STATE(worker->next, DESIGNATED_POLLER);
|
878
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
881
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
879
882
|
gpr_cv_signal(&worker->next->cv);
|
880
|
-
if (
|
883
|
+
if (grpc_core::ExecCtx::Get()->HasWork()) {
|
881
884
|
gpr_mu_unlock(&pollset->mu);
|
882
|
-
|
885
|
+
grpc_core::ExecCtx::Get()->Flush();
|
883
886
|
gpr_mu_lock(&pollset->mu);
|
884
887
|
}
|
885
888
|
} else {
|
@@ -894,8 +897,7 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
894
897
|
&g_neighborhoods[(poller_neighborhood_idx + i) %
|
895
898
|
g_num_neighborhoods];
|
896
899
|
if (gpr_mu_trylock(&neighborhood->mu)) {
|
897
|
-
found_worker =
|
898
|
-
check_neighborhood_for_available_poller(exec_ctx, neighborhood);
|
900
|
+
found_worker = check_neighborhood_for_available_poller(neighborhood);
|
899
901
|
gpr_mu_unlock(&neighborhood->mu);
|
900
902
|
scan_state[i] = true;
|
901
903
|
} else {
|
@@ -908,16 +910,15 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
908
910
|
&g_neighborhoods[(poller_neighborhood_idx + i) %
|
909
911
|
g_num_neighborhoods];
|
910
912
|
gpr_mu_lock(&neighborhood->mu);
|
911
|
-
found_worker =
|
912
|
-
check_neighborhood_for_available_poller(exec_ctx, neighborhood);
|
913
|
+
found_worker = check_neighborhood_for_available_poller(neighborhood);
|
913
914
|
gpr_mu_unlock(&neighborhood->mu);
|
914
915
|
}
|
915
|
-
|
916
|
+
grpc_core::ExecCtx::Get()->Flush();
|
916
917
|
gpr_mu_lock(&pollset->mu);
|
917
918
|
}
|
918
|
-
} else if (
|
919
|
+
} else if (grpc_core::ExecCtx::Get()->HasWork()) {
|
919
920
|
gpr_mu_unlock(&pollset->mu);
|
920
|
-
|
921
|
+
grpc_core::ExecCtx::Get()->Flush();
|
921
922
|
gpr_mu_lock(&pollset->mu);
|
922
923
|
}
|
923
924
|
if (worker->initialized_cv) {
|
@@ -927,7 +928,7 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
927
928
|
gpr_log(GPR_DEBUG, " .. remove worker");
|
928
929
|
}
|
929
930
|
if (EMPTIED == worker_remove(pollset, worker)) {
|
930
|
-
pollset_maybe_finish_shutdown(
|
931
|
+
pollset_maybe_finish_shutdown(pollset);
|
931
932
|
}
|
932
933
|
GPR_ASSERT(gpr_atm_no_barrier_load(&g_active_poller) != (gpr_atm)worker);
|
933
934
|
GPR_TIMER_END("end_worker", 0);
|
@@ -937,7 +938,7 @@ static void end_worker(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
937
938
|
The function pollset_work() may temporarily release the lock (pollset->po.mu)
|
938
939
|
during the course of its execution but it will always re-acquire the lock and
|
939
940
|
ensure that it is held by the time the function returns */
|
940
|
-
static grpc_error* pollset_work(
|
941
|
+
static grpc_error* pollset_work(grpc_pollset* ps,
|
941
942
|
grpc_pollset_worker** worker_hdl,
|
942
943
|
grpc_millis deadline) {
|
943
944
|
grpc_pollset_worker worker;
|
@@ -950,7 +951,7 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
|
|
950
951
|
return GRPC_ERROR_NONE;
|
951
952
|
}
|
952
953
|
|
953
|
-
if (begin_worker(
|
954
|
+
if (begin_worker(ps, &worker, worker_hdl, deadline)) {
|
954
955
|
gpr_tls_set(&g_current_thread_pollset, (intptr_t)ps);
|
955
956
|
gpr_tls_set(&g_current_thread_worker, (intptr_t)&worker);
|
956
957
|
GPR_ASSERT(!ps->shutting_down);
|
@@ -968,14 +969,14 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
|
|
968
969
|
|
969
970
|
process_epoll_events() returns very quickly: It just queues the work on
|
970
971
|
exec_ctx but does not execute it (the actual exectution or more
|
971
|
-
accurately
|
972
|
-
a designated poller). So we are not waiting long periods
|
973
|
-
designated poller */
|
972
|
+
accurately grpc_core::ExecCtx::Get()->Flush() happens in end_worker()
|
973
|
+
AFTER selecting a designated poller). So we are not waiting long periods
|
974
|
+
without a designated poller */
|
974
975
|
if (gpr_atm_acq_load(&g_epoll_set.cursor) ==
|
975
976
|
gpr_atm_acq_load(&g_epoll_set.num_events)) {
|
976
|
-
append_error(&error, do_epoll_wait(
|
977
|
+
append_error(&error, do_epoll_wait(ps, deadline), err_desc);
|
977
978
|
}
|
978
|
-
append_error(&error, process_epoll_events(
|
979
|
+
append_error(&error, process_epoll_events(ps), err_desc);
|
979
980
|
|
980
981
|
gpr_mu_lock(&ps->mu); /* lock */
|
981
982
|
|
@@ -983,17 +984,17 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
|
|
983
984
|
} else {
|
984
985
|
gpr_tls_set(&g_current_thread_pollset, (intptr_t)ps);
|
985
986
|
}
|
986
|
-
end_worker(
|
987
|
+
end_worker(ps, &worker, worker_hdl);
|
987
988
|
|
988
989
|
gpr_tls_set(&g_current_thread_pollset, 0);
|
989
990
|
GPR_TIMER_END("pollset_work", 0);
|
990
991
|
return error;
|
991
992
|
}
|
992
993
|
|
993
|
-
static grpc_error* pollset_kick(
|
994
|
+
static grpc_error* pollset_kick(grpc_pollset* pollset,
|
994
995
|
grpc_pollset_worker* specific_worker) {
|
995
996
|
GPR_TIMER_BEGIN("pollset_kick", 0);
|
996
|
-
GRPC_STATS_INC_POLLSET_KICK(
|
997
|
+
GRPC_STATS_INC_POLLSET_KICK();
|
997
998
|
grpc_error* ret_err = GRPC_ERROR_NONE;
|
998
999
|
if (grpc_polling_trace.enabled()) {
|
999
1000
|
gpr_strvec log;
|
@@ -1026,7 +1027,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1026
1027
|
if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)pollset) {
|
1027
1028
|
grpc_pollset_worker* root_worker = pollset->root_worker;
|
1028
1029
|
if (root_worker == nullptr) {
|
1029
|
-
GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER(
|
1030
|
+
GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER();
|
1030
1031
|
pollset->kicked_without_poller = true;
|
1031
1032
|
if (grpc_polling_trace.enabled()) {
|
1032
1033
|
gpr_log(GPR_ERROR, " .. kicked_without_poller");
|
@@ -1035,14 +1036,14 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1035
1036
|
}
|
1036
1037
|
grpc_pollset_worker* next_worker = root_worker->next;
|
1037
1038
|
if (root_worker->state == KICKED) {
|
1038
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(
|
1039
|
+
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1039
1040
|
if (grpc_polling_trace.enabled()) {
|
1040
1041
|
gpr_log(GPR_ERROR, " .. already kicked %p", root_worker);
|
1041
1042
|
}
|
1042
1043
|
SET_KICK_STATE(root_worker, KICKED);
|
1043
1044
|
goto done;
|
1044
1045
|
} else if (next_worker->state == KICKED) {
|
1045
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(
|
1046
|
+
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1046
1047
|
if (grpc_polling_trace.enabled()) {
|
1047
1048
|
gpr_log(GPR_ERROR, " .. already kicked %p", next_worker);
|
1048
1049
|
}
|
@@ -1053,7 +1054,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1053
1054
|
// there is no next worker
|
1054
1055
|
root_worker == (grpc_pollset_worker*)gpr_atm_no_barrier_load(
|
1055
1056
|
&g_active_poller)) {
|
1056
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(
|
1057
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1057
1058
|
if (grpc_polling_trace.enabled()) {
|
1058
1059
|
gpr_log(GPR_ERROR, " .. kicked %p", root_worker);
|
1059
1060
|
}
|
@@ -1061,7 +1062,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1061
1062
|
ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd);
|
1062
1063
|
goto done;
|
1063
1064
|
} else if (next_worker->state == UNKICKED) {
|
1064
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
1065
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1065
1066
|
if (grpc_polling_trace.enabled()) {
|
1066
1067
|
gpr_log(GPR_ERROR, " .. kicked %p", next_worker);
|
1067
1068
|
}
|
@@ -1079,12 +1080,12 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1079
1080
|
}
|
1080
1081
|
SET_KICK_STATE(root_worker, KICKED);
|
1081
1082
|
if (root_worker->initialized_cv) {
|
1082
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
1083
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1083
1084
|
gpr_cv_signal(&root_worker->cv);
|
1084
1085
|
}
|
1085
1086
|
goto done;
|
1086
1087
|
} else {
|
1087
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(
|
1088
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1088
1089
|
if (grpc_polling_trace.enabled()) {
|
1089
1090
|
gpr_log(GPR_ERROR, " .. non-root poller %p (root=%p)", next_worker,
|
1090
1091
|
root_worker);
|
@@ -1094,13 +1095,13 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1094
1095
|
goto done;
|
1095
1096
|
}
|
1096
1097
|
} else {
|
1097
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(
|
1098
|
+
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1098
1099
|
GPR_ASSERT(next_worker->state == KICKED);
|
1099
1100
|
SET_KICK_STATE(next_worker, KICKED);
|
1100
1101
|
goto done;
|
1101
1102
|
}
|
1102
1103
|
} else {
|
1103
|
-
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD(
|
1104
|
+
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD();
|
1104
1105
|
if (grpc_polling_trace.enabled()) {
|
1105
1106
|
gpr_log(GPR_ERROR, " .. kicked while waking up");
|
1106
1107
|
}
|
@@ -1117,7 +1118,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1117
1118
|
goto done;
|
1118
1119
|
} else if (gpr_tls_get(&g_current_thread_worker) ==
|
1119
1120
|
(intptr_t)specific_worker) {
|
1120
|
-
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD(
|
1121
|
+
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD();
|
1121
1122
|
if (grpc_polling_trace.enabled()) {
|
1122
1123
|
gpr_log(GPR_ERROR, " .. mark %p kicked", specific_worker);
|
1123
1124
|
}
|
@@ -1125,7 +1126,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1125
1126
|
goto done;
|
1126
1127
|
} else if (specific_worker ==
|
1127
1128
|
(grpc_pollset_worker*)gpr_atm_no_barrier_load(&g_active_poller)) {
|
1128
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(
|
1129
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1129
1130
|
if (grpc_polling_trace.enabled()) {
|
1130
1131
|
gpr_log(GPR_ERROR, " .. kick active poller");
|
1131
1132
|
}
|
@@ -1133,7 +1134,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1133
1134
|
ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd);
|
1134
1135
|
goto done;
|
1135
1136
|
} else if (specific_worker->initialized_cv) {
|
1136
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(
|
1137
|
+
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1137
1138
|
if (grpc_polling_trace.enabled()) {
|
1138
1139
|
gpr_log(GPR_ERROR, " .. kick waiting worker");
|
1139
1140
|
}
|
@@ -1141,7 +1142,7 @@ static grpc_error* pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset,
|
|
1141
1142
|
gpr_cv_signal(&specific_worker->cv);
|
1142
1143
|
goto done;
|
1143
1144
|
} else {
|
1144
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(
|
1145
|
+
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1145
1146
|
if (grpc_polling_trace.enabled()) {
|
1146
1147
|
gpr_log(GPR_ERROR, " .. kick non-waiting worker");
|
1147
1148
|
}
|
@@ -1153,8 +1154,7 @@ done:
|
|
1153
1154
|
return ret_err;
|
1154
1155
|
}
|
1155
1156
|
|
1156
|
-
static void pollset_add_fd(
|
1157
|
-
grpc_fd* fd) {}
|
1157
|
+
static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {}
|
1158
1158
|
|
1159
1159
|
/*******************************************************************************
|
1160
1160
|
* Pollset-set Definitions
|
@@ -1164,27 +1164,20 @@ static grpc_pollset_set* pollset_set_create(void) {
|
|
1164
1164
|
return (grpc_pollset_set*)((intptr_t)0xdeafbeef);
|
1165
1165
|
}
|
1166
1166
|
|
1167
|
-
static void pollset_set_destroy(
|
1168
|
-
grpc_pollset_set* pss) {}
|
1167
|
+
static void pollset_set_destroy(grpc_pollset_set* pss) {}
|
1169
1168
|
|
1170
|
-
static void pollset_set_add_fd(
|
1171
|
-
grpc_fd* fd) {}
|
1169
|
+
static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) {}
|
1172
1170
|
|
1173
|
-
static void pollset_set_del_fd(
|
1174
|
-
grpc_fd* fd) {}
|
1171
|
+
static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) {}
|
1175
1172
|
|
1176
|
-
static void pollset_set_add_pollset(
|
1177
|
-
grpc_pollset_set* pss, grpc_pollset* ps) {}
|
1173
|
+
static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {}
|
1178
1174
|
|
1179
|
-
static void pollset_set_del_pollset(
|
1180
|
-
grpc_pollset_set* pss, grpc_pollset* ps) {}
|
1175
|
+
static void pollset_set_del_pollset(grpc_pollset_set* pss, grpc_pollset* ps) {}
|
1181
1176
|
|
1182
|
-
static void pollset_set_add_pollset_set(
|
1183
|
-
grpc_pollset_set* bag,
|
1177
|
+
static void pollset_set_add_pollset_set(grpc_pollset_set* bag,
|
1184
1178
|
grpc_pollset_set* item) {}
|
1185
1179
|
|
1186
|
-
static void pollset_set_del_pollset_set(
|
1187
|
-
grpc_pollset_set* bag,
|
1180
|
+
static void pollset_set_del_pollset_set(grpc_pollset_set* bag,
|
1188
1181
|
grpc_pollset_set* item) {}
|
1189
1182
|
|
1190
1183
|
/*******************************************************************************
|
@@ -1258,7 +1251,7 @@ const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) {
|
|
1258
1251
|
/* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return
|
1259
1252
|
* NULL */
|
1260
1253
|
const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) {
|
1261
|
-
return
|
1254
|
+
return nullptr;
|
1262
1255
|
}
|
1263
1256
|
#endif /* defined(GRPC_POSIX_SOCKET) */
|
1264
1257
|
#endif /* !defined(GRPC_LINUX_EPOLL) */
|