grpc-flamingo 1.11.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +1150 -176
- data/etc/roots.pem +40 -196
- data/include/grpc/grpc.h +49 -8
- data/include/grpc/grpc_security.h +123 -2
- data/include/grpc/grpc_security_constants.h +6 -0
- data/include/grpc/impl/codegen/fork.h +4 -4
- data/include/grpc/impl/codegen/grpc_types.h +26 -5
- data/include/grpc/impl/codegen/log.h +112 -0
- data/include/grpc/impl/codegen/port_platform.h +55 -4
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/support/log.h +2 -80
- data/include/grpc/support/string_util.h +2 -0
- data/include/grpc/support/sync.h +0 -16
- data/src/boringssl/err_data.c +602 -588
- data/src/core/ext/{census → filters/census}/grpc_context.cc +0 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +1234 -1070
- data/src/core/ext/filters/client_channel/client_channel.h +5 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +113 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +71 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +22 -5
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +30 -10
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +120 -127
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +36 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +36 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +37 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +25 -22
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +4 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +37 -63
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +306 -239
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +444 -392
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +538 -98
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -0
- data/src/core/ext/filters/client_channel/method_params.h +4 -0
- data/src/core/ext/filters/client_channel/resolver.h +10 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +36 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +320 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +62 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +49 -294
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +537 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +112 -87
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +17 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +6 -5
- data/src/core/ext/filters/{load_reporting/server_load_reporting_filter.h → client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc} +7 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +29 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +32 -15
- data/src/core/ext/filters/client_channel/retry_throttle.h +4 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +58 -15
- data/src/core/ext/filters/client_channel/subchannel.h +11 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +18 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +5 -5
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -9
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -5
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +6 -6
- data/src/core/ext/filters/http/server/http_server_filter.cc +123 -131
- data/src/core/ext/filters/http/server/http_server_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +9 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +97 -48
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +12 -8
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +32 -27
- data/src/core/ext/transport/inproc/inproc_transport.cc +87 -49
- data/src/core/lib/channel/channel_args.cc +28 -0
- data/src/core/lib/channel/channel_args.h +4 -0
- data/src/core/lib/channel/channel_stack.cc +22 -29
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.cc +0 -3
- data/src/core/lib/channel/channel_stack_builder.h +0 -2
- data/src/core/lib/channel/channel_trace.cc +28 -63
- data/src/core/lib/channel/channel_trace.h +13 -17
- data/src/core/lib/channel/channelz.cc +153 -0
- data/src/core/lib/channel/channelz.h +133 -0
- data/src/core/lib/channel/channelz_registry.cc +145 -0
- data/src/core/lib/channel/channelz_registry.h +120 -0
- data/src/core/lib/channel/connected_channel.cc +8 -1
- data/src/core/lib/channel/handshaker.cc +71 -0
- data/src/core/lib/channel/handshaker.h +4 -0
- data/src/core/lib/debug/stats.h +7 -0
- data/src/core/lib/debug/stats_data.cc +5 -0
- data/src/core/lib/debug/stats_data.h +120 -0
- data/src/core/lib/debug/trace.cc +2 -1
- data/src/core/lib/debug/trace.h +12 -1
- data/src/core/lib/gpr/alloc.h +28 -0
- data/src/core/lib/gpr/arena.cc +38 -45
- data/src/core/lib/gpr/log.cc +8 -2
- data/src/core/lib/gpr/log_android.cc +4 -0
- data/src/core/lib/gpr/log_linux.cc +4 -0
- data/src/core/lib/gpr/log_posix.cc +4 -0
- data/src/core/lib/gpr/log_windows.cc +5 -0
- data/src/core/lib/gpr/string.cc +28 -0
- data/src/core/lib/gpr/string.h +10 -0
- data/src/core/lib/gprpp/abstract.h +5 -2
- data/src/core/lib/gprpp/fork.cc +268 -0
- data/src/core/lib/gprpp/fork.h +88 -0
- data/src/core/lib/gprpp/inlined_vector.h +87 -37
- data/src/core/lib/gprpp/memory.h +12 -0
- data/src/core/lib/gprpp/mutex_lock.h +42 -0
- data/src/core/lib/gprpp/orphanable.h +10 -12
- data/src/core/lib/gprpp/ref_counted.h +10 -12
- data/src/core/lib/gprpp/ref_counted_ptr.h +65 -8
- data/src/core/lib/gprpp/thd.h +0 -3
- data/src/core/lib/gprpp/thd_posix.cc +5 -54
- data/src/core/lib/gprpp/thd_windows.cc +0 -7
- data/src/core/lib/http/httpcli_security_connector.cc +1 -3
- data/src/core/lib/iomgr/call_combiner.cc +13 -13
- data/src/core/lib/iomgr/call_combiner.h +84 -1
- data/src/core/lib/iomgr/closure.h +6 -5
- data/src/core/lib/iomgr/combiner.cc +30 -13
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +12 -0
- data/src/core/lib/iomgr/error.h +5 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +138 -51
- data/src/core/lib/iomgr/ev_epollex_linux.cc +276 -93
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +58 -50
- data/src/core/lib/iomgr/ev_poll_posix.cc +163 -42
- data/src/core/lib/iomgr/ev_posix.cc +88 -24
- data/src/core/lib/iomgr/ev_posix.h +48 -12
- data/src/core/lib/iomgr/exec_ctx.cc +15 -9
- data/src/core/lib/iomgr/exec_ctx.h +48 -20
- data/src/core/lib/iomgr/executor.cc +274 -142
- data/src/core/lib/iomgr/executor.h +82 -16
- data/src/core/lib/iomgr/fork_posix.cc +42 -19
- data/src/core/lib/iomgr/iocp_windows.cc +9 -4
- data/src/core/lib/iomgr/iomgr.cc +2 -0
- data/src/core/lib/iomgr/iomgr.h +5 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -0
- data/src/core/lib/iomgr/lockfree_event.cc +5 -1
- data/src/core/lib/iomgr/polling_entity.cc +11 -2
- data/src/core/lib/iomgr/pollset_custom.cc +2 -2
- data/src/core/lib/iomgr/port.h +51 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +3 -2
- data/src/core/lib/iomgr/resource_quota.cc +89 -12
- data/src/core/lib/iomgr/resource_quota.h +16 -0
- data/src/core/lib/iomgr/sockaddr_posix.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +1 -1
- data/src/core/lib/iomgr/socket_utils.h +9 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -1
- data/src/core/lib/iomgr/socket_utils_linux.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_windows.cc +4 -0
- data/src/core/lib/iomgr/socket_windows.cc +33 -0
- data/src/core/lib/iomgr/socket_windows.h +6 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_client_posix.cc +10 -11
- data/src/core/lib/iomgr/tcp_custom.cc +11 -11
- data/src/core/lib/iomgr/tcp_posix.cc +49 -36
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_posix.cc +16 -36
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +17 -5
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -0
- data/src/core/lib/iomgr/tcp_uv.cc +3 -0
- data/src/core/lib/iomgr/tcp_windows.cc +18 -2
- data/src/core/lib/iomgr/tcp_windows.h +2 -0
- data/src/core/lib/iomgr/timer.h +4 -3
- data/src/core/lib/iomgr/timer_generic.cc +133 -51
- data/src/core/lib/iomgr/timer_manager.cc +12 -14
- data/src/core/lib/iomgr/timer_uv.cc +3 -0
- data/src/core/lib/iomgr/udp_server.cc +106 -52
- data/src/core/lib/iomgr/udp_server.h +8 -4
- data/src/core/lib/json/json.cc +12 -1
- data/src/core/lib/json/json.h +5 -0
- data/src/core/lib/profiling/basic_timers.cc +1 -0
- data/src/core/lib/security/context/security_context.cc +8 -8
- data/src/core/lib/security/context/security_context.h +6 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.h +0 -20
- data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +3 -2
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +7 -7
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +1 -38
- data/src/core/lib/security/credentials/credentials.h +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +89 -115
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +16 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/local/local_credentials.cc +77 -0
- data/src/core/lib/security/credentials/local/local_credentials.h +40 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +11 -7
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +17 -3
- data/src/core/lib/security/security_connector/alts_security_connector.cc +2 -1
- data/src/core/lib/security/security_connector/load_system_roots.h +29 -0
- data/src/core/lib/{gpr/fork.h → security/security_connector/load_system_roots_fallback.cc} +10 -13
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +165 -0
- data/src/core/lib/security/security_connector/load_system_roots_linux.h +44 -0
- data/src/core/lib/security/security_connector/local_security_connector.cc +245 -0
- data/src/core/lib/security/security_connector/local_security_connector.h +58 -0
- data/src/core/lib/security/security_connector/security_connector.cc +79 -32
- data/src/core/lib/security/security_connector/security_connector.h +5 -3
- data/src/core/lib/security/transport/client_auth_filter.cc +5 -5
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +7 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -7
- data/src/core/lib/security/util/json_util.cc +4 -0
- data/src/core/lib/slice/slice.cc +6 -2
- data/src/core/lib/slice/slice_buffer.cc +27 -7
- data/src/core/lib/slice/slice_hash_table.h +4 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -0
- data/src/core/lib/surface/call.cc +119 -58
- data/src/core/lib/surface/call.h +7 -0
- data/src/core/lib/surface/channel.cc +50 -18
- data/src/core/lib/surface/channel.h +4 -0
- data/src/core/lib/surface/completion_queue.cc +153 -18
- data/src/core/lib/surface/completion_queue.h +20 -2
- data/src/core/lib/surface/completion_queue_factory.cc +13 -4
- data/src/core/lib/surface/init.cc +7 -8
- data/src/core/lib/surface/init.h +0 -1
- data/src/core/lib/surface/server.cc +16 -0
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/byte_stream.cc +1 -1
- data/src/core/lib/transport/connectivity_state.cc +6 -7
- data/src/core/lib/transport/service_config.cc +2 -2
- data/src/core/lib/transport/service_config.h +3 -3
- data/src/core/lib/transport/transport.cc +22 -10
- data/src/core/lib/transport/transport.h +18 -18
- data/src/core/lib/transport/transport_op_string.cc +1 -8
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +2 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +19 -7
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +10 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +38 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +47 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -11
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +7 -2
- data/src/core/tsi/fake_transport_security.cc +1 -0
- data/src/core/tsi/grpc_shadow_boringssl.h +3006 -0
- data/src/core/tsi/local_transport_security.cc +209 -0
- data/src/core/tsi/local_transport_security.h +51 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +5 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -0
- data/src/core/tsi/ssl_transport_security.cc +245 -116
- data/src/core/tsi/ssl_types.h +2 -0
- data/src/core/tsi/transport_security.cc +14 -0
- data/src/core/tsi/transport_security.h +2 -0
- data/src/core/tsi/transport_security_interface.h +11 -1
- data/src/ruby/bin/math_client.rb +17 -9
- data/src/ruby/ext/grpc/extconf.rb +1 -26
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +42 -16
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +65 -26
- data/src/ruby/lib/grpc/generic/active_call.rb +19 -23
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +7 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +4 -1
- data/src/ruby/spec/call_credentials_spec.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +1 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -12
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/compression_options_spec.rb +1 -1
- data/src/ruby/spec/error_sanity_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +16 -4
- data/src/ruby/spec/generic/rpc_desc_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
- data/src/ruby/spec/generic/service_spec.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +1 -12
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +1 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +1 -1
- data/src/ruby/spec/spec_helper.rb +1 -0
- data/src/ruby/spec/support/services.rb +1 -1
- data/src/ruby/spec/time_consts_spec.rb +1 -1
- data/third_party/address_sorting/address_sorting.c +17 -11
- data/third_party/address_sorting/address_sorting_windows.c +43 -3
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +3 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +33 -28
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +24 -22
- data/third_party/boringssl/crypto/asn1/a_utf8.c +13 -11
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +40 -19
- data/third_party/boringssl/crypto/bio/fd.c +1 -0
- data/third_party/boringssl/crypto/bio/file.c +2 -0
- data/third_party/boringssl/crypto/bn_extra/convert.c +6 -5
- data/third_party/boringssl/crypto/bytestring/ber.c +1 -4
- data/third_party/boringssl/crypto/bytestring/cbb.c +116 -16
- data/third_party/boringssl/crypto/bytestring/cbs.c +151 -20
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +203 -0
- data/third_party/boringssl/crypto/cipher_extra/e_rc2.c +2 -0
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +1 -2
- data/third_party/boringssl/crypto/cpu-aarch64-fuchsia.c +55 -0
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +2 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +16 -54
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +9 -10
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +11 -542
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +57 -112
- data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +128 -70
- data/third_party/boringssl/crypto/fipsmodule/bn/bytes.c +32 -71
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +64 -118
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +284 -122
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +31 -65
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +274 -218
- data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +2 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +187 -27
- data/third_party/boringssl/crypto/fipsmodule/bn/jacobi.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +124 -81
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +8 -30
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +321 -347
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +326 -66
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +77 -25
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +199 -222
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +27 -47
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +155 -96
- data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +10 -10
- data/third_party/boringssl/crypto/fipsmodule/des/internal.h +2 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +78 -47
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +99 -163
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +3 -10
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +44 -23
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +59 -90
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +38 -65
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +5378 -5418
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -26
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +15 -11
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +45 -51
- data/third_party/boringssl/crypto/fipsmodule/ec/{util-64.c → util.c} +0 -5
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +144 -264
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +78 -62
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +256 -0
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +36 -32
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +9 -7
- data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +16 -40
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +1 -6
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +57 -39
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +309 -142
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +581 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/internal.h +39 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/kdf.c +165 -0
- data/third_party/boringssl/crypto/internal.h +65 -2
- data/third_party/boringssl/crypto/mem.c +0 -2
- data/third_party/boringssl/crypto/obj/obj.c +6 -73
- data/third_party/boringssl/crypto/thread_pthread.c +35 -5
- data/third_party/boringssl/crypto/x509/a_strex.c +11 -11
- data/third_party/boringssl/crypto/x509/vpm_int.h +1 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +4 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +44 -22
- data/third_party/boringssl/crypto/x509/x_name.c +13 -0
- data/third_party/boringssl/include/openssl/aead.h +10 -0
- data/third_party/boringssl/include/openssl/asn1.h +2 -3
- data/third_party/boringssl/include/openssl/base.h +5 -14
- data/third_party/boringssl/include/openssl/bio.h +1 -1
- data/third_party/boringssl/include/openssl/bn.h +62 -18
- data/third_party/boringssl/include/openssl/bytestring.h +53 -28
- data/third_party/boringssl/include/openssl/crypto.h +4 -0
- data/third_party/boringssl/include/openssl/ec.h +10 -4
- data/third_party/boringssl/include/openssl/ec_key.h +7 -6
- data/third_party/boringssl/include/openssl/err.h +9 -9
- data/third_party/boringssl/include/openssl/evp.h +1 -1
- data/third_party/boringssl/include/openssl/rsa.h +35 -10
- data/third_party/boringssl/include/openssl/ssl.h +167 -19
- data/third_party/boringssl/include/openssl/ssl3.h +0 -1
- data/third_party/boringssl/include/openssl/stack.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +10 -2
- data/third_party/boringssl/include/openssl/x509.h +4 -0
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/d1_both.cc +16 -2
- data/third_party/boringssl/ssl/dtls_method.cc +1 -1
- data/third_party/boringssl/ssl/handoff.cc +285 -0
- data/third_party/boringssl/ssl/handshake.cc +26 -12
- data/third_party/boringssl/ssl/handshake_client.cc +101 -95
- data/third_party/boringssl/ssl/handshake_server.cc +14 -2
- data/third_party/boringssl/ssl/internal.h +132 -79
- data/third_party/boringssl/ssl/s3_both.cc +2 -2
- data/third_party/boringssl/ssl/s3_lib.cc +3 -1
- data/third_party/boringssl/ssl/s3_pkt.cc +0 -18
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +1 -4
- data/third_party/boringssl/ssl/ssl_asn1.cc +47 -43
- data/third_party/boringssl/ssl/ssl_cipher.cc +12 -8
- data/third_party/boringssl/ssl/ssl_key_share.cc +3 -1
- data/third_party/boringssl/ssl/ssl_lib.cc +83 -14
- data/third_party/boringssl/ssl/ssl_privkey.cc +6 -0
- data/third_party/boringssl/ssl/ssl_stat.cc +6 -6
- data/third_party/boringssl/ssl/ssl_versions.cc +12 -85
- data/third_party/boringssl/ssl/ssl_x509.cc +59 -61
- data/third_party/boringssl/ssl/t1_enc.cc +73 -124
- data/third_party/boringssl/ssl/t1_lib.cc +367 -41
- data/third_party/boringssl/ssl/tls13_both.cc +8 -0
- data/third_party/boringssl/ssl/tls13_client.cc +98 -184
- data/third_party/boringssl/ssl/tls13_enc.cc +88 -158
- data/third_party/boringssl/ssl/tls13_server.cc +91 -137
- data/third_party/boringssl/ssl/tls_method.cc +0 -17
- data/third_party/boringssl/ssl/tls_record.cc +1 -10
- data/third_party/boringssl/third_party/fiat/curve25519.c +921 -2753
- data/third_party/boringssl/third_party/fiat/curve25519_tables.h +7880 -0
- data/third_party/boringssl/third_party/fiat/internal.h +32 -20
- data/third_party/boringssl/third_party/fiat/p256.c +1824 -0
- metadata +86 -71
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +0 -253
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +0 -222
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +0 -71
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -61
- data/src/core/lib/channel/channel_trace_registry.cc +0 -80
- data/src/core/lib/channel/channel_trace_registry.h +0 -43
- data/src/core/lib/gpr/fork.cc +0 -78
- data/src/core/tsi/transport_security_adapter.cc +0 -235
- data/src/core/tsi/transport_security_adapter.h +0 -41
- data/src/ruby/bin/apis/google/protobuf/empty.rb +0 -29
- data/src/ruby/bin/apis/pubsub_demo.rb +0 -241
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +0 -159
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +0 -88
- data/src/ruby/pb/test/client.rb +0 -764
- data/src/ruby/pb/test/server.rb +0 -252
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +0 -54
- data/src/ruby/spec/pb/package_with_underscore/data.proto +0 -23
- data/src/ruby/spec/pb/package_with_underscore/service.proto +0 -23
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +0 -247
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +0 -1674
@@ -222,10 +222,10 @@ static void finish_accept(grpc_tcp_listener* sp, grpc_custom_socket* socket) {
|
|
222
222
|
}
|
223
223
|
if (grpc_tcp_trace.enabled()) {
|
224
224
|
if (peer_name_string) {
|
225
|
-
gpr_log(
|
225
|
+
gpr_log(GPR_INFO, "SERVER_CONNECT: %p accepted connection: %s",
|
226
226
|
sp->server, peer_name_string);
|
227
227
|
} else {
|
228
|
-
gpr_log(
|
228
|
+
gpr_log(GPR_INFO, "SERVER_CONNECT: %p accepted connection", sp->server);
|
229
229
|
}
|
230
230
|
}
|
231
231
|
ep = custom_tcp_endpoint_create(socket, sp->server->resource_quota,
|
@@ -377,10 +377,10 @@ static grpc_error* tcp_server_add_port(grpc_tcp_server* s,
|
|
377
377
|
grpc_sockaddr_to_string(&port_string, addr, 0);
|
378
378
|
const char* str = grpc_error_string(error);
|
379
379
|
if (port_string) {
|
380
|
-
gpr_log(
|
380
|
+
gpr_log(GPR_INFO, "SERVER %p add_port %s error=%s", s, port_string, str);
|
381
381
|
gpr_free(port_string);
|
382
382
|
} else {
|
383
|
-
gpr_log(
|
383
|
+
gpr_log(GPR_INFO, "SERVER %p add_port error=%s", s, str);
|
384
384
|
}
|
385
385
|
}
|
386
386
|
|
@@ -419,7 +419,7 @@ static void tcp_server_start(grpc_tcp_server* server, grpc_pollset** pollsets,
|
|
419
419
|
(void)pollset_count;
|
420
420
|
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
|
421
421
|
if (grpc_tcp_trace.enabled()) {
|
422
|
-
gpr_log(
|
422
|
+
gpr_log(GPR_INFO, "SERVER_START %p", server);
|
423
423
|
}
|
424
424
|
GPR_ASSERT(on_accept_cb);
|
425
425
|
GPR_ASSERT(!server->on_accept_cb);
|
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
#include "src/core/lib/iomgr/port.h"
|
27
27
|
|
28
|
-
#ifdef
|
28
|
+
#ifdef GRPC_POSIX_SOCKET_TCP_SERVER
|
29
29
|
|
30
30
|
#include "src/core/lib/iomgr/tcp_server.h"
|
31
31
|
|
@@ -55,39 +55,18 @@
|
|
55
55
|
#include "src/core/lib/iomgr/tcp_server_utils_posix.h"
|
56
56
|
#include "src/core/lib/iomgr/unix_sockets_posix.h"
|
57
57
|
|
58
|
-
static gpr_once check_init = GPR_ONCE_INIT;
|
59
|
-
static bool has_so_reuseport = false;
|
60
|
-
|
61
|
-
static void init(void) {
|
62
|
-
#ifndef GPR_MANYLINUX1
|
63
|
-
int s = socket(AF_INET, SOCK_STREAM, 0);
|
64
|
-
if (s < 0) {
|
65
|
-
/* This might be an ipv6-only environment in which case 'socket(AF_INET,..)'
|
66
|
-
call would fail. Try creating IPv6 socket in that case */
|
67
|
-
s = socket(AF_INET6, SOCK_STREAM, 0);
|
68
|
-
}
|
69
|
-
if (s >= 0) {
|
70
|
-
has_so_reuseport = GRPC_LOG_IF_ERROR("check for SO_REUSEPORT",
|
71
|
-
grpc_set_socket_reuse_port(s, 1));
|
72
|
-
close(s);
|
73
|
-
}
|
74
|
-
#endif
|
75
|
-
}
|
76
|
-
|
77
58
|
static grpc_error* tcp_server_create(grpc_closure* shutdown_complete,
|
78
59
|
const grpc_channel_args* args,
|
79
60
|
grpc_tcp_server** server) {
|
80
|
-
gpr_once_init(&check_init, init);
|
81
|
-
|
82
61
|
grpc_tcp_server* s =
|
83
62
|
static_cast<grpc_tcp_server*>(gpr_zalloc(sizeof(grpc_tcp_server)));
|
84
|
-
s->so_reuseport =
|
63
|
+
s->so_reuseport = grpc_is_socket_reuse_port_supported();
|
85
64
|
s->expand_wildcard_addrs = false;
|
86
65
|
for (size_t i = 0; i < (args == nullptr ? 0 : args->num_args); i++) {
|
87
66
|
if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) {
|
88
67
|
if (args->args[i].type == GRPC_ARG_INTEGER) {
|
89
|
-
s->so_reuseport =
|
90
|
-
|
68
|
+
s->so_reuseport = grpc_is_socket_reuse_port_supported() &&
|
69
|
+
(args->args[i].value.integer != 0);
|
91
70
|
} else {
|
92
71
|
gpr_free(s);
|
93
72
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(GRPC_ARG_ALLOW_REUSEPORT
|
@@ -171,7 +150,7 @@ static void deactivated_all_ports(grpc_tcp_server* s) {
|
|
171
150
|
GRPC_CLOSURE_INIT(&sp->destroyed_closure, destroyed_port, s,
|
172
151
|
grpc_schedule_on_exec_ctx);
|
173
152
|
grpc_fd_orphan(sp->emfd, &sp->destroyed_closure, nullptr,
|
174
|
-
|
153
|
+
"tcp_listener_shutdown");
|
175
154
|
}
|
176
155
|
gpr_mu_unlock(&s->mu);
|
177
156
|
} else {
|
@@ -208,11 +187,6 @@ static void on_read(void* arg, grpc_error* err) {
|
|
208
187
|
goto error;
|
209
188
|
}
|
210
189
|
|
211
|
-
read_notifier_pollset =
|
212
|
-
sp->server->pollsets[static_cast<size_t>(gpr_atm_no_barrier_fetch_add(
|
213
|
-
&sp->server->next_pollset_to_assign, 1)) %
|
214
|
-
sp->server->pollset_count];
|
215
|
-
|
216
190
|
/* loop until accept4 returns EAGAIN, and then re-arm notification */
|
217
191
|
for (;;) {
|
218
192
|
grpc_resolved_address addr;
|
@@ -249,10 +223,15 @@ static void on_read(void* arg, grpc_error* err) {
|
|
249
223
|
gpr_asprintf(&name, "tcp-server-connection:%s", addr_str);
|
250
224
|
|
251
225
|
if (grpc_tcp_trace.enabled()) {
|
252
|
-
gpr_log(
|
226
|
+
gpr_log(GPR_INFO, "SERVER_CONNECT: incoming connection: %s", addr_str);
|
253
227
|
}
|
254
228
|
|
255
|
-
grpc_fd* fdobj = grpc_fd_create(fd, name);
|
229
|
+
grpc_fd* fdobj = grpc_fd_create(fd, name, false);
|
230
|
+
|
231
|
+
read_notifier_pollset =
|
232
|
+
sp->server->pollsets[static_cast<size_t>(gpr_atm_no_barrier_fetch_add(
|
233
|
+
&sp->server->next_pollset_to_assign, 1)) %
|
234
|
+
sp->server->pollset_count];
|
256
235
|
|
257
236
|
grpc_pollset_add_fd(read_notifier_pollset, fdobj);
|
258
237
|
|
@@ -367,7 +346,8 @@ static grpc_error* clone_port(grpc_tcp_listener* listener, unsigned count) {
|
|
367
346
|
err = grpc_create_dualstack_socket(&listener->addr, SOCK_STREAM, 0, &dsmode,
|
368
347
|
&fd);
|
369
348
|
if (err != GRPC_ERROR_NONE) return err;
|
370
|
-
err = grpc_tcp_server_prepare_socket(fd, &listener->addr,
|
349
|
+
err = grpc_tcp_server_prepare_socket(listener->server, fd, &listener->addr,
|
350
|
+
true, &port);
|
371
351
|
if (err != GRPC_ERROR_NONE) return err;
|
372
352
|
listener->server->nports++;
|
373
353
|
grpc_sockaddr_to_string(&addr_str, &listener->addr, 1);
|
@@ -382,7 +362,7 @@ static grpc_error* clone_port(grpc_tcp_listener* listener, unsigned count) {
|
|
382
362
|
listener->sibling = sp;
|
383
363
|
sp->server = listener->server;
|
384
364
|
sp->fd = fd;
|
385
|
-
sp->emfd = grpc_fd_create(fd, name);
|
365
|
+
sp->emfd = grpc_fd_create(fd, name, false);
|
386
366
|
memcpy(&sp->addr, &listener->addr, sizeof(grpc_resolved_address));
|
387
367
|
sp->port = port;
|
388
368
|
sp->port_index = listener->port_index;
|
@@ -579,4 +559,4 @@ grpc_tcp_server_vtable grpc_posix_tcp_server_vtable = {
|
|
579
559
|
tcp_server_shutdown_starting_add,
|
580
560
|
tcp_server_unref,
|
581
561
|
tcp_server_shutdown_listeners};
|
582
|
-
#endif
|
562
|
+
#endif /* GRPC_POSIX_SOCKET_TCP_SERVER */
|
@@ -113,7 +113,7 @@ grpc_error* grpc_tcp_server_add_all_local_addrs(grpc_tcp_server* s,
|
|
113
113
|
int* out_port);
|
114
114
|
|
115
115
|
/* Prepare a recently-created socket for listening. */
|
116
|
-
grpc_error* grpc_tcp_server_prepare_socket(int fd,
|
116
|
+
grpc_error* grpc_tcp_server_prepare_socket(grpc_tcp_server*, int fd,
|
117
117
|
const grpc_resolved_address* addr,
|
118
118
|
bool so_reuseport, int* port);
|
119
119
|
/* Ruturn true if the platform supports ifaddrs */
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
#include "src/core/lib/iomgr/port.h"
|
22
22
|
|
23
|
-
#ifdef
|
23
|
+
#ifdef GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON
|
24
24
|
|
25
25
|
#include "src/core/lib/iomgr/tcp_server_utils_posix.h"
|
26
26
|
|
@@ -87,7 +87,7 @@ static grpc_error* add_socket_to_server(grpc_tcp_server* s, int fd,
|
|
87
87
|
char* name;
|
88
88
|
|
89
89
|
grpc_error* err =
|
90
|
-
grpc_tcp_server_prepare_socket(fd, addr, s->so_reuseport, &port);
|
90
|
+
grpc_tcp_server_prepare_socket(s, fd, addr, s->so_reuseport, &port);
|
91
91
|
if (err == GRPC_ERROR_NONE) {
|
92
92
|
GPR_ASSERT(port > 0);
|
93
93
|
grpc_sockaddr_to_string(&addr_str, addr, 1);
|
@@ -105,7 +105,7 @@ static grpc_error* add_socket_to_server(grpc_tcp_server* s, int fd,
|
|
105
105
|
s->tail = sp;
|
106
106
|
sp->server = s;
|
107
107
|
sp->fd = fd;
|
108
|
-
sp->emfd = grpc_fd_create(fd, name);
|
108
|
+
sp->emfd = grpc_fd_create(fd, name, false);
|
109
109
|
memcpy(&sp->addr, addr, sizeof(grpc_resolved_address));
|
110
110
|
sp->port = port;
|
111
111
|
sp->port_index = port_index;
|
@@ -144,7 +144,7 @@ grpc_error* grpc_tcp_server_add_addr(grpc_tcp_server* s,
|
|
144
144
|
}
|
145
145
|
|
146
146
|
/* Prepare a recently-created socket for listening. */
|
147
|
-
grpc_error* grpc_tcp_server_prepare_socket(int fd,
|
147
|
+
grpc_error* grpc_tcp_server_prepare_socket(grpc_tcp_server* s, int fd,
|
148
148
|
const grpc_resolved_address* addr,
|
149
149
|
bool so_reuseport, int* port) {
|
150
150
|
grpc_resolved_address sockname_temp;
|
@@ -170,6 +170,18 @@ grpc_error* grpc_tcp_server_prepare_socket(int fd,
|
|
170
170
|
err = grpc_set_socket_no_sigpipe_if_possible(fd);
|
171
171
|
if (err != GRPC_ERROR_NONE) goto error;
|
172
172
|
|
173
|
+
if (s->channel_args) {
|
174
|
+
for (size_t i = 0; i < s->channel_args->num_args; i++) {
|
175
|
+
if (0 == strcmp(s->channel_args->args[i].key, GRPC_ARG_SOCKET_MUTATOR)) {
|
176
|
+
GPR_ASSERT(s->channel_args->args[i].type == GRPC_ARG_POINTER);
|
177
|
+
grpc_socket_mutator* mutator = static_cast<grpc_socket_mutator*>(
|
178
|
+
s->channel_args->args[i].value.pointer.p);
|
179
|
+
err = grpc_set_socket_with_mutator(fd, mutator);
|
180
|
+
if (err != GRPC_ERROR_NONE) goto error;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
173
185
|
if (bind(fd, reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)),
|
174
186
|
addr->len) < 0) {
|
175
187
|
err = GRPC_OS_ERROR(errno, "bind");
|
@@ -205,4 +217,4 @@ error:
|
|
205
217
|
return ret;
|
206
218
|
}
|
207
219
|
|
208
|
-
#endif /*
|
220
|
+
#endif /* GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON */
|
@@ -204,6 +204,9 @@ static grpc_error* uv_socket_init_helper(uv_socket_t* uv_socket, int domain) {
|
|
204
204
|
uv_socket->write_buffers = nullptr;
|
205
205
|
uv_socket->read_len = 0;
|
206
206
|
uv_tcp_nodelay(uv_socket->handle, 1);
|
207
|
+
// Node uses a garbage collector to call destructors, so we don't
|
208
|
+
// want to hold the uv loop open with active gRPC objects.
|
209
|
+
uv_unref((uv_handle_t*)uv_socket->handle);
|
207
210
|
uv_socket->pending_connection = false;
|
208
211
|
uv_socket->accept_socket = nullptr;
|
209
212
|
uv_socket->accept_error = GRPC_ERROR_NONE;
|
@@ -53,7 +53,7 @@
|
|
53
53
|
|
54
54
|
extern grpc_core::TraceFlag grpc_tcp_trace;
|
55
55
|
|
56
|
-
|
56
|
+
grpc_error* grpc_tcp_set_non_block(SOCKET sock) {
|
57
57
|
int status;
|
58
58
|
uint32_t param = 1;
|
59
59
|
DWORD ret;
|
@@ -74,12 +74,28 @@ static grpc_error* set_dualstack(SOCKET sock) {
|
|
74
74
|
: GRPC_WSA_ERROR(WSAGetLastError(), "setsockopt(IPV6_V6ONLY)");
|
75
75
|
}
|
76
76
|
|
77
|
+
static grpc_error* enable_loopback_fast_path(SOCKET sock) {
|
78
|
+
int status;
|
79
|
+
uint32_t param = 1;
|
80
|
+
DWORD ret;
|
81
|
+
status = WSAIoctl(sock, /*SIO_LOOPBACK_FAST_PATH==*/_WSAIOW(IOC_VENDOR, 16),
|
82
|
+
¶m, sizeof(param), NULL, 0, &ret, 0, 0);
|
83
|
+
if (status == SOCKET_ERROR) {
|
84
|
+
status = WSAGetLastError();
|
85
|
+
}
|
86
|
+
return status == 0 || status == WSAEOPNOTSUPP
|
87
|
+
? GRPC_ERROR_NONE
|
88
|
+
: GRPC_WSA_ERROR(status, "WSAIoctl(SIO_LOOPBACK_FAST_PATH)");
|
89
|
+
}
|
90
|
+
|
77
91
|
grpc_error* grpc_tcp_prepare_socket(SOCKET sock) {
|
78
92
|
grpc_error* err;
|
79
|
-
err =
|
93
|
+
err = grpc_tcp_set_non_block(sock);
|
80
94
|
if (err != GRPC_ERROR_NONE) return err;
|
81
95
|
err = set_dualstack(sock);
|
82
96
|
if (err != GRPC_ERROR_NONE) return err;
|
97
|
+
err = enable_loopback_fast_path(sock);
|
98
|
+
if (err != GRPC_ERROR_NONE) return err;
|
83
99
|
return GRPC_ERROR_NONE;
|
84
100
|
}
|
85
101
|
|
data/src/core/lib/iomgr/timer.h
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
#include "src/core/lib/iomgr/iomgr.h"
|
29
29
|
|
30
30
|
typedef struct grpc_timer {
|
31
|
-
|
31
|
+
grpc_millis deadline;
|
32
32
|
uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */
|
33
33
|
bool pending;
|
34
34
|
struct grpc_timer* next;
|
@@ -61,10 +61,11 @@ typedef struct grpc_timer_vtable {
|
|
61
61
|
|
62
62
|
/* Initialize *timer. When expired or canceled, closure will be called with
|
63
63
|
error set to indicate if it expired (GRPC_ERROR_NONE) or was canceled
|
64
|
-
(GRPC_ERROR_CANCELLED).
|
64
|
+
(GRPC_ERROR_CANCELLED). *closure is guaranteed to be called exactly once, and
|
65
65
|
application code should check the error to determine how it was invoked. The
|
66
66
|
application callback is also responsible for maintaining information about
|
67
|
-
when to free up any user-level state.
|
67
|
+
when to free up any user-level state. Behavior is undefined for a deadline of
|
68
|
+
GRPC_MILLIS_INF_FUTURE. */
|
68
69
|
void grpc_timer_init(grpc_timer* timer, grpc_millis deadline,
|
69
70
|
grpc_closure* closure);
|
70
71
|
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include "src/core/lib/gpr/spinlock.h"
|
35
35
|
#include "src/core/lib/gpr/tls.h"
|
36
36
|
#include "src/core/lib/gpr/useful.h"
|
37
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
37
38
|
#include "src/core/lib/iomgr/time_averaged_stats.h"
|
38
39
|
#include "src/core/lib/iomgr/timer_heap.h"
|
39
40
|
|
@@ -59,9 +60,9 @@ typedef struct {
|
|
59
60
|
gpr_mu mu;
|
60
61
|
grpc_time_averaged_stats stats;
|
61
62
|
/* All and only timers with deadlines <= this will be in the heap. */
|
62
|
-
|
63
|
+
grpc_millis queue_deadline_cap;
|
63
64
|
/* The deadline of the next timer due in this shard */
|
64
|
-
|
65
|
+
grpc_millis min_deadline;
|
65
66
|
/* Index of this timer_shard in the g_shard_queue */
|
66
67
|
uint32_t shard_queue_index;
|
67
68
|
/* This holds all timers with deadlines < queue_deadline_cap. Timers in this
|
@@ -97,6 +98,12 @@ static void init_timer_ht() {
|
|
97
98
|
}
|
98
99
|
}
|
99
100
|
|
101
|
+
static void destroy_timer_ht() {
|
102
|
+
for (int i = 0; i < NUM_HASH_BUCKETS; i++) {
|
103
|
+
gpr_mu_destroy(&g_hash_mu[i]);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
100
107
|
static bool is_in_ht(grpc_timer* t) {
|
101
108
|
size_t i = GPR_HASH_POINTER(t, NUM_HASH_BUCKETS);
|
102
109
|
|
@@ -188,6 +195,7 @@ static void validate_non_pending_timer(grpc_timer* t) {
|
|
188
195
|
}
|
189
196
|
|
190
197
|
#define INIT_TIMER_HASH_TABLE() init_timer_ht()
|
198
|
+
#define DESTROY_TIMER_HASH_TABLE() destroy_timer_ht()
|
191
199
|
#define ADD_TO_HASH_TABLE(t) add_to_ht((t))
|
192
200
|
#define REMOVE_FROM_HASH_TABLE(t) remove_from_ht((t))
|
193
201
|
#define VALIDATE_NON_PENDING_TIMER(t) validate_non_pending_timer((t))
|
@@ -195,21 +203,30 @@ static void validate_non_pending_timer(grpc_timer* t) {
|
|
195
203
|
#else
|
196
204
|
|
197
205
|
#define INIT_TIMER_HASH_TABLE()
|
206
|
+
#define DESTROY_TIMER_HASH_TABLE()
|
198
207
|
#define ADD_TO_HASH_TABLE(t)
|
199
208
|
#define REMOVE_FROM_HASH_TABLE(t)
|
200
209
|
#define VALIDATE_NON_PENDING_TIMER(t)
|
201
210
|
|
202
211
|
#endif
|
203
212
|
|
213
|
+
#if GPR_ARCH_64
|
214
|
+
/* NOTE: TODO(sreek) - Currently the thread local storage support in grpc is
|
215
|
+
for intptr_t which means on 32-bit machines it is not wide enough to hold
|
216
|
+
grpc_millis which is 64-bit. Adding thread local support for 64 bit values
|
217
|
+
is a lot of work for very little gain. So we are currently restricting this
|
218
|
+
optimization to only 64 bit machines */
|
219
|
+
|
204
220
|
/* Thread local variable that stores the deadline of the next timer the thread
|
205
221
|
* has last-seen. This is an optimization to prevent the thread from checking
|
206
222
|
* shared_mutables.min_timer (which requires acquiring shared_mutables.mu lock,
|
207
223
|
* an expensive operation) */
|
208
224
|
GPR_TLS_DECL(g_last_seen_min_timer);
|
225
|
+
#endif
|
209
226
|
|
210
227
|
struct shared_mutables {
|
211
228
|
/* The deadline of the next timer due across all timer shards */
|
212
|
-
|
229
|
+
grpc_millis min_timer;
|
213
230
|
/* Allow only one run_some_expired_timers at once */
|
214
231
|
gpr_spinlock checker_mu;
|
215
232
|
bool initialized;
|
@@ -219,18 +236,18 @@ struct shared_mutables {
|
|
219
236
|
|
220
237
|
static struct shared_mutables g_shared_mutables;
|
221
238
|
|
222
|
-
static
|
223
|
-
if (a >
|
224
|
-
return
|
239
|
+
static grpc_millis saturating_add(grpc_millis a, grpc_millis b) {
|
240
|
+
if (a > GRPC_MILLIS_INF_FUTURE - b) {
|
241
|
+
return GRPC_MILLIS_INF_FUTURE;
|
225
242
|
}
|
226
243
|
return a + b;
|
227
244
|
}
|
228
245
|
|
229
|
-
static grpc_timer_check_result run_some_expired_timers(
|
230
|
-
|
246
|
+
static grpc_timer_check_result run_some_expired_timers(grpc_millis now,
|
247
|
+
grpc_millis* next,
|
231
248
|
grpc_error* error);
|
232
249
|
|
233
|
-
static
|
250
|
+
static grpc_millis compute_min_deadline(timer_shard* shard) {
|
234
251
|
return grpc_timer_heap_is_empty(&shard->heap)
|
235
252
|
? saturating_add(shard->queue_deadline_cap, 1)
|
236
253
|
: grpc_timer_heap_top(&shard->heap)->deadline;
|
@@ -249,8 +266,11 @@ static void timer_list_init() {
|
|
249
266
|
g_shared_mutables.checker_mu = GPR_SPINLOCK_INITIALIZER;
|
250
267
|
gpr_mu_init(&g_shared_mutables.mu);
|
251
268
|
g_shared_mutables.min_timer = grpc_core::ExecCtx::Get()->Now();
|
269
|
+
|
270
|
+
#if GPR_ARCH_64
|
252
271
|
gpr_tls_init(&g_last_seen_min_timer);
|
253
272
|
gpr_tls_set(&g_last_seen_min_timer, 0);
|
273
|
+
#endif
|
254
274
|
|
255
275
|
for (i = 0; i < g_num_shards; i++) {
|
256
276
|
timer_shard* shard = &g_shards[i];
|
@@ -279,10 +299,16 @@ static void timer_list_shutdown() {
|
|
279
299
|
grpc_timer_heap_destroy(&shard->heap);
|
280
300
|
}
|
281
301
|
gpr_mu_destroy(&g_shared_mutables.mu);
|
302
|
+
|
303
|
+
#if GPR_ARCH_64
|
282
304
|
gpr_tls_destroy(&g_last_seen_min_timer);
|
305
|
+
#endif
|
306
|
+
|
283
307
|
gpr_free(g_shards);
|
284
308
|
gpr_free(g_shard_queue);
|
285
309
|
g_shared_mutables.initialized = false;
|
310
|
+
|
311
|
+
DESTROY_TIMER_HASH_TABLE();
|
286
312
|
}
|
287
313
|
|
288
314
|
/* returns true if the first element in the list */
|
@@ -336,9 +362,9 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
|
|
336
362
|
#endif
|
337
363
|
|
338
364
|
if (grpc_timer_trace.enabled()) {
|
339
|
-
gpr_log(
|
340
|
-
|
341
|
-
|
365
|
+
gpr_log(GPR_INFO, "TIMER %p: SET %" PRId64 " now %" PRId64 " call %p[%p]",
|
366
|
+
timer, deadline, grpc_core::ExecCtx::Get()->Now(), closure,
|
367
|
+
closure->cb);
|
342
368
|
}
|
343
369
|
|
344
370
|
if (!g_shared_mutables.initialized) {
|
@@ -372,8 +398,8 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
|
|
372
398
|
list_join(&shard->list, timer);
|
373
399
|
}
|
374
400
|
if (grpc_timer_trace.enabled()) {
|
375
|
-
gpr_log(
|
376
|
-
" .. add to shard %d with queue_deadline_cap=%"
|
401
|
+
gpr_log(GPR_INFO,
|
402
|
+
" .. add to shard %d with queue_deadline_cap=%" PRId64
|
377
403
|
" => is_first_timer=%s",
|
378
404
|
static_cast<int>(shard - g_shards), shard->queue_deadline_cap,
|
379
405
|
is_first_timer ? "true" : "false");
|
@@ -394,15 +420,27 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
|
|
394
420
|
if (is_first_timer) {
|
395
421
|
gpr_mu_lock(&g_shared_mutables.mu);
|
396
422
|
if (grpc_timer_trace.enabled()) {
|
397
|
-
gpr_log(
|
423
|
+
gpr_log(GPR_INFO, " .. old shard min_deadline=%" PRId64,
|
398
424
|
shard->min_deadline);
|
399
425
|
}
|
400
426
|
if (deadline < shard->min_deadline) {
|
401
|
-
|
427
|
+
grpc_millis old_min_deadline = g_shard_queue[0]->min_deadline;
|
402
428
|
shard->min_deadline = deadline;
|
403
429
|
note_deadline_change(shard);
|
404
430
|
if (shard->shard_queue_index == 0 && deadline < old_min_deadline) {
|
405
|
-
|
431
|
+
#if GPR_ARCH_64
|
432
|
+
// TODO: sreek - Using c-style cast here. static_cast<> gives an error
|
433
|
+
// (on mac platforms complaining that gpr_atm* is (long *) while
|
434
|
+
// (&g_shared_mutables.min_timer) is a (long long *). The cast should be
|
435
|
+
// safe since we know that both are pointer types and 64-bit wide.
|
436
|
+
gpr_atm_no_barrier_store((gpr_atm*)(&g_shared_mutables.min_timer),
|
437
|
+
deadline);
|
438
|
+
#else
|
439
|
+
// On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit
|
440
|
+
// types (like grpc_millis). So all reads and writes to
|
441
|
+
// g_shared_mutables.min_timer varialbe under g_shared_mutables.mu
|
442
|
+
g_shared_mutables.min_timer = deadline;
|
443
|
+
#endif
|
406
444
|
grpc_kick_poller();
|
407
445
|
}
|
408
446
|
}
|
@@ -411,8 +449,10 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
|
|
411
449
|
}
|
412
450
|
|
413
451
|
static void timer_consume_kick(void) {
|
414
|
-
|
452
|
+
#if GPR_ARCH_64
|
453
|
+
/* Force re-evaluation of last seen min */
|
415
454
|
gpr_tls_set(&g_last_seen_min_timer, 0);
|
455
|
+
#endif
|
416
456
|
}
|
417
457
|
|
418
458
|
static void timer_cancel(grpc_timer* timer) {
|
@@ -424,7 +464,7 @@ static void timer_cancel(grpc_timer* timer) {
|
|
424
464
|
timer_shard* shard = &g_shards[GPR_HASH_POINTER(timer, g_num_shards)];
|
425
465
|
gpr_mu_lock(&shard->mu);
|
426
466
|
if (grpc_timer_trace.enabled()) {
|
427
|
-
gpr_log(
|
467
|
+
gpr_log(GPR_INFO, "TIMER %p: CANCEL pending=%s", timer,
|
428
468
|
timer->pending ? "true" : "false");
|
429
469
|
}
|
430
470
|
|
@@ -449,7 +489,7 @@ static void timer_cancel(grpc_timer* timer) {
|
|
449
489
|
'queue_deadline_cap') into into shard->heap.
|
450
490
|
Returns 'true' if shard->heap has atleast ONE element
|
451
491
|
REQUIRES: shard->mu locked */
|
452
|
-
static int refill_heap(timer_shard* shard,
|
492
|
+
static int refill_heap(timer_shard* shard, grpc_millis now) {
|
453
493
|
/* Compute the new queue window width and bound by the limits: */
|
454
494
|
double computed_deadline_delta =
|
455
495
|
grpc_time_averaged_stats_update_average(&shard->stats) *
|
@@ -462,10 +502,10 @@ static int refill_heap(timer_shard* shard, gpr_atm now) {
|
|
462
502
|
/* Compute the new cap and put all timers under it into the queue: */
|
463
503
|
shard->queue_deadline_cap =
|
464
504
|
saturating_add(GPR_MAX(now, shard->queue_deadline_cap),
|
465
|
-
static_cast<
|
505
|
+
static_cast<grpc_millis>(deadline_delta * 1000.0));
|
466
506
|
|
467
507
|
if (grpc_timer_check_trace.enabled()) {
|
468
|
-
gpr_log(
|
508
|
+
gpr_log(GPR_INFO, " .. shard[%d]->queue_deadline_cap --> %" PRId64,
|
469
509
|
static_cast<int>(shard - g_shards), shard->queue_deadline_cap);
|
470
510
|
}
|
471
511
|
for (timer = shard->list.next; timer != &shard->list; timer = next) {
|
@@ -473,7 +513,7 @@ static int refill_heap(timer_shard* shard, gpr_atm now) {
|
|
473
513
|
|
474
514
|
if (timer->deadline < shard->queue_deadline_cap) {
|
475
515
|
if (grpc_timer_check_trace.enabled()) {
|
476
|
-
gpr_log(
|
516
|
+
gpr_log(GPR_INFO, " .. add timer with deadline %" PRId64 " to heap",
|
477
517
|
timer->deadline);
|
478
518
|
}
|
479
519
|
list_remove(timer);
|
@@ -486,11 +526,11 @@ static int refill_heap(timer_shard* shard, gpr_atm now) {
|
|
486
526
|
/* This pops the next non-cancelled timer with deadline <= now from the
|
487
527
|
queue, or returns NULL if there isn't one.
|
488
528
|
REQUIRES: shard->mu locked */
|
489
|
-
static grpc_timer* pop_one(timer_shard* shard,
|
529
|
+
static grpc_timer* pop_one(timer_shard* shard, grpc_millis now) {
|
490
530
|
grpc_timer* timer;
|
491
531
|
for (;;) {
|
492
532
|
if (grpc_timer_check_trace.enabled()) {
|
493
|
-
gpr_log(
|
533
|
+
gpr_log(GPR_INFO, " .. shard[%d]: heap_empty=%s",
|
494
534
|
static_cast<int>(shard - g_shards),
|
495
535
|
grpc_timer_heap_is_empty(&shard->heap) ? "true" : "false");
|
496
536
|
}
|
@@ -500,13 +540,13 @@ static grpc_timer* pop_one(timer_shard* shard, gpr_atm now) {
|
|
500
540
|
}
|
501
541
|
timer = grpc_timer_heap_top(&shard->heap);
|
502
542
|
if (grpc_timer_check_trace.enabled()) {
|
503
|
-
gpr_log(
|
504
|
-
" .. check top timer deadline=%"
|
543
|
+
gpr_log(GPR_INFO,
|
544
|
+
" .. check top timer deadline=%" PRId64 " now=%" PRId64,
|
505
545
|
timer->deadline, now);
|
506
546
|
}
|
507
547
|
if (timer->deadline > now) return nullptr;
|
508
548
|
if (grpc_timer_trace.enabled()) {
|
509
|
-
gpr_log(
|
549
|
+
gpr_log(GPR_INFO, "TIMER %p: FIRE %" PRId64 "ms late via %s scheduler",
|
510
550
|
timer, now - timer->deadline,
|
511
551
|
timer->closure->scheduler->vtable->name);
|
512
552
|
}
|
@@ -517,8 +557,8 @@ static grpc_timer* pop_one(timer_shard* shard, gpr_atm now) {
|
|
517
557
|
}
|
518
558
|
|
519
559
|
/* REQUIRES: shard->mu unlocked */
|
520
|
-
static size_t pop_timers(timer_shard* shard,
|
521
|
-
|
560
|
+
static size_t pop_timers(timer_shard* shard, grpc_millis now,
|
561
|
+
grpc_millis* new_min_deadline, grpc_error* error) {
|
522
562
|
size_t n = 0;
|
523
563
|
grpc_timer* timer;
|
524
564
|
gpr_mu_lock(&shard->mu);
|
@@ -530,19 +570,33 @@ static size_t pop_timers(timer_shard* shard, gpr_atm now,
|
|
530
570
|
*new_min_deadline = compute_min_deadline(shard);
|
531
571
|
gpr_mu_unlock(&shard->mu);
|
532
572
|
if (grpc_timer_check_trace.enabled()) {
|
533
|
-
gpr_log(
|
573
|
+
gpr_log(GPR_INFO, " .. shard[%d] popped %" PRIdPTR,
|
534
574
|
static_cast<int>(shard - g_shards), n);
|
535
575
|
}
|
536
576
|
return n;
|
537
577
|
}
|
538
578
|
|
539
|
-
static grpc_timer_check_result run_some_expired_timers(
|
540
|
-
|
579
|
+
static grpc_timer_check_result run_some_expired_timers(grpc_millis now,
|
580
|
+
grpc_millis* next,
|
541
581
|
grpc_error* error) {
|
542
582
|
grpc_timer_check_result result = GRPC_TIMERS_NOT_CHECKED;
|
543
583
|
|
544
|
-
|
584
|
+
#if GPR_ARCH_64
|
585
|
+
// TODO: sreek - Using c-style cast here. static_cast<> gives an error (on
|
586
|
+
// mac platforms complaining that gpr_atm* is (long *) while
|
587
|
+
// (&g_shared_mutables.min_timer) is a (long long *). The cast should be
|
588
|
+
// safe since we know that both are pointer types and 64-bit wide
|
589
|
+
grpc_millis min_timer = static_cast<grpc_millis>(
|
590
|
+
gpr_atm_no_barrier_load((gpr_atm*)(&g_shared_mutables.min_timer)));
|
545
591
|
gpr_tls_set(&g_last_seen_min_timer, min_timer);
|
592
|
+
#else
|
593
|
+
// On 32-bit systems, gpr_atm_no_barrier_load does not work on 64-bit types
|
594
|
+
// (like grpc_millis). So all reads and writes to g_shared_mutables.min_timer
|
595
|
+
// are done under g_shared_mutables.mu
|
596
|
+
gpr_mu_lock(&g_shared_mutables.mu);
|
597
|
+
grpc_millis min_timer = g_shared_mutables.min_timer;
|
598
|
+
gpr_mu_unlock(&g_shared_mutables.mu);
|
599
|
+
#endif
|
546
600
|
if (now < min_timer) {
|
547
601
|
if (next != nullptr) *next = GPR_MIN(*next, min_timer);
|
548
602
|
return GRPC_TIMERS_CHECKED_AND_EMPTY;
|
@@ -553,14 +607,15 @@ static grpc_timer_check_result run_some_expired_timers(gpr_atm now,
|
|
553
607
|
result = GRPC_TIMERS_CHECKED_AND_EMPTY;
|
554
608
|
|
555
609
|
if (grpc_timer_check_trace.enabled()) {
|
556
|
-
gpr_log(
|
610
|
+
gpr_log(GPR_INFO, " .. shard[%d]->min_deadline = %" PRId64,
|
557
611
|
static_cast<int>(g_shard_queue[0] - g_shards),
|
558
612
|
g_shard_queue[0]->min_deadline);
|
559
613
|
}
|
560
614
|
|
561
615
|
while (g_shard_queue[0]->min_deadline < now ||
|
562
|
-
(now !=
|
563
|
-
|
616
|
+
(now != GRPC_MILLIS_INF_FUTURE &&
|
617
|
+
g_shard_queue[0]->min_deadline == now)) {
|
618
|
+
grpc_millis new_min_deadline;
|
564
619
|
|
565
620
|
/* For efficiency, we pop as many available timers as we can from the
|
566
621
|
shard. This may violate perfect timer deadline ordering, but that
|
@@ -570,10 +625,10 @@ static grpc_timer_check_result run_some_expired_timers(gpr_atm now,
|
|
570
625
|
}
|
571
626
|
|
572
627
|
if (grpc_timer_check_trace.enabled()) {
|
573
|
-
gpr_log(
|
628
|
+
gpr_log(GPR_INFO,
|
574
629
|
" .. result --> %d"
|
575
|
-
", shard[%d]->min_deadline %"
|
576
|
-
", now=%"
|
630
|
+
", shard[%d]->min_deadline %" PRId64 " --> %" PRId64
|
631
|
+
", now=%" PRId64,
|
577
632
|
result, static_cast<int>(g_shard_queue[0] - g_shards),
|
578
633
|
g_shard_queue[0]->min_deadline, new_min_deadline, now);
|
579
634
|
}
|
@@ -591,8 +646,19 @@ static grpc_timer_check_result run_some_expired_timers(gpr_atm now,
|
|
591
646
|
*next = GPR_MIN(*next, g_shard_queue[0]->min_deadline);
|
592
647
|
}
|
593
648
|
|
594
|
-
|
649
|
+
#if GPR_ARCH_64
|
650
|
+
// TODO: sreek - Using c-style cast here. static_cast<> gives an error (on
|
651
|
+
// mac platforms complaining that gpr_atm* is (long *) while
|
652
|
+
// (&g_shared_mutables.min_timer) is a (long long *). The cast should be
|
653
|
+
// safe since we know that both are pointer types and 64-bit wide
|
654
|
+
gpr_atm_no_barrier_store((gpr_atm*)(&g_shared_mutables.min_timer),
|
595
655
|
g_shard_queue[0]->min_deadline);
|
656
|
+
#else
|
657
|
+
// On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit
|
658
|
+
// types (like grpc_millis). So all reads and writes to
|
659
|
+
// g_shared_mutables.min_timer are done under g_shared_mutables.mu
|
660
|
+
g_shared_mutables.min_timer = g_shard_queue[0]->min_deadline;
|
661
|
+
#endif
|
596
662
|
gpr_mu_unlock(&g_shared_mutables.mu);
|
597
663
|
gpr_spinlock_unlock(&g_shared_mutables.checker_mu);
|
598
664
|
}
|
@@ -606,17 +672,28 @@ static grpc_timer_check_result timer_check(grpc_millis* next) {
|
|
606
672
|
// prelude
|
607
673
|
grpc_millis now = grpc_core::ExecCtx::Get()->Now();
|
608
674
|
|
675
|
+
#if GPR_ARCH_64
|
609
676
|
/* fetch from a thread-local first: this avoids contention on a globally
|
610
677
|
mutable cacheline in the common case */
|
611
678
|
grpc_millis min_timer = gpr_tls_get(&g_last_seen_min_timer);
|
679
|
+
#else
|
680
|
+
// On 32-bit systems, we currently do not have thread local support for 64-bit
|
681
|
+
// types. In this case, directly read from g_shared_mutables.min_timer.
|
682
|
+
// Also, note that on 32-bit systems, gpr_atm_no_barrier_store does not work
|
683
|
+
// on 64-bit types (like grpc_millis). So all reads and writes to
|
684
|
+
// g_shared_mutables.min_timer are done under g_shared_mutables.mu
|
685
|
+
gpr_mu_lock(&g_shared_mutables.mu);
|
686
|
+
grpc_millis min_timer = g_shared_mutables.min_timer;
|
687
|
+
gpr_mu_unlock(&g_shared_mutables.mu);
|
688
|
+
#endif
|
689
|
+
|
612
690
|
if (now < min_timer) {
|
613
691
|
if (next != nullptr) {
|
614
692
|
*next = GPR_MIN(*next, min_timer);
|
615
693
|
}
|
616
694
|
if (grpc_timer_check_trace.enabled()) {
|
617
|
-
gpr_log(
|
618
|
-
|
619
|
-
min_timer);
|
695
|
+
gpr_log(GPR_INFO, "TIMER CHECK SKIP: now=%" PRId64 " min_timer=%" PRId64,
|
696
|
+
now, min_timer);
|
620
697
|
}
|
621
698
|
return GRPC_TIMERS_CHECKED_AND_EMPTY;
|
622
699
|
}
|
@@ -632,13 +709,18 @@ static grpc_timer_check_result timer_check(grpc_millis* next) {
|
|
632
709
|
if (next == nullptr) {
|
633
710
|
next_str = gpr_strdup("NULL");
|
634
711
|
} else {
|
635
|
-
gpr_asprintf(&next_str, "%"
|
712
|
+
gpr_asprintf(&next_str, "%" PRId64, *next);
|
636
713
|
}
|
637
|
-
|
638
|
-
|
714
|
+
#if GPR_ARCH_64
|
715
|
+
gpr_log(GPR_INFO,
|
716
|
+
"TIMER CHECK BEGIN: now=%" PRId64 " next=%s tls_min=%" PRId64
|
639
717
|
" glob_min=%" PRIdPTR,
|
640
|
-
now, next_str,
|
641
|
-
gpr_atm_no_barrier_load(&g_shared_mutables.min_timer));
|
718
|
+
now, next_str, min_timer,
|
719
|
+
gpr_atm_no_barrier_load((gpr_atm*)(&g_shared_mutables.min_timer)));
|
720
|
+
#else
|
721
|
+
gpr_log(GPR_INFO, "TIMER CHECK BEGIN: now=%" PRId64 " next=%s min=%" PRId64,
|
722
|
+
now, next_str, min_timer);
|
723
|
+
#endif
|
642
724
|
gpr_free(next_str);
|
643
725
|
}
|
644
726
|
// actual code
|
@@ -650,9 +732,9 @@ static grpc_timer_check_result timer_check(grpc_millis* next) {
|
|
650
732
|
if (next == nullptr) {
|
651
733
|
next_str = gpr_strdup("NULL");
|
652
734
|
} else {
|
653
|
-
gpr_asprintf(&next_str, "%"
|
735
|
+
gpr_asprintf(&next_str, "%" PRId64, *next);
|
654
736
|
}
|
655
|
-
gpr_log(
|
737
|
+
gpr_log(GPR_INFO, "TIMER CHECK END: r=%d; next=%s", r, next_str);
|
656
738
|
gpr_free(next_str);
|
657
739
|
}
|
658
740
|
return r;
|