grpc 1.55.0 → 1.56.0.pre3
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 +100 -68
- data/include/grpc/event_engine/event_engine.h +4 -3
- data/include/grpc/grpc_audit_logging.h +96 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/support/json.h +218 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +5 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +4 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +86 -104
- data/src/core/ext/filters/client_channel/client_channel.h +6 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +19 -18
- data/src/core/ext/filters/client_channel/client_channel_internal.h +16 -21
- data/src/core/ext/filters/client_channel/config_selector.h +9 -24
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +455 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +186 -0
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +2 -7
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +52 -20
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +23 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -6
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +1 -9
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +16 -7
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +18 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +12 -9
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +36 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +76 -6
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +32 -39
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +4 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +52 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +1 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +14 -16
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +7 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +35 -33
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +29 -4
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/service_config_helper.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +28 -27
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +163 -46
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +16 -1
- data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +10 -40
- data/src/core/ext/filters/client_channel/subchannel.cc +10 -196
- data/src/core/ext/filters/client_channel/subchannel.h +3 -43
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +5 -5
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +100 -6
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -8
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +16 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +46 -95
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -15
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +11 -2
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +15 -0
- data/src/core/ext/xds/certificate_provider_store.cc +4 -9
- data/src/core/ext/xds/certificate_provider_store.h +1 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +30 -42
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +14 -9
- data/src/core/ext/xds/xds_api.cc +9 -6
- data/src/core/ext/xds/xds_api.h +3 -2
- data/src/core/ext/xds/xds_audit_logger_registry.cc +122 -0
- data/src/core/ext/xds/xds_audit_logger_registry.h +68 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +21 -9
- data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -0
- data/src/core/ext/xds/xds_client.cc +5 -4
- data/src/core/ext/xds/xds_client_stats.h +1 -1
- data/src/core/ext/xds/xds_cluster.cc +20 -19
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +11 -8
- data/src/core/ext/xds/xds_common_types.cc +3 -1
- data/src/core/ext/xds/xds_http_fault_filter.cc +16 -13
- data/src/core/ext/xds/xds_http_fault_filter.h +2 -1
- data/src/core/ext/xds/xds_http_filters.h +4 -2
- data/src/core/ext/xds/xds_http_rbac_filter.cc +154 -67
- data/src/core/ext/xds/xds_http_rbac_filter.h +2 -1
- data/src/core/ext/xds/xds_http_stateful_session_filter.cc +15 -11
- data/src/core/ext/xds/xds_http_stateful_session_filter.h +2 -1
- data/src/core/ext/xds/xds_lb_policy_registry.cc +22 -16
- data/src/core/ext/xds/xds_listener.cc +1 -0
- data/src/core/ext/xds/xds_route_config.cc +40 -3
- data/src/core/ext/xds/xds_routing.cc +2 -2
- data/src/core/ext/xds/xds_transport_grpc.cc +3 -1
- data/src/core/lib/avl/avl.h +5 -0
- data/src/core/lib/channel/channel_args.cc +80 -22
- data/src/core/lib/channel/channel_args.h +34 -1
- data/src/core/lib/channel/channel_trace.cc +16 -12
- data/src/core/lib/channel/channelz.cc +159 -132
- data/src/core/lib/channel/channelz.h +42 -35
- data/src/core/lib/channel/channelz_registry.cc +23 -20
- data/src/core/lib/channel/connected_channel.cc +17 -6
- data/src/core/lib/channel/promise_based_filter.cc +0 -4
- data/src/core/lib/channel/promise_based_filter.h +2 -0
- data/src/core/lib/compression/compression_internal.cc +2 -5
- data/src/core/lib/config/config_vars.cc +20 -18
- data/src/core/lib/config/config_vars.h +4 -4
- data/src/core/lib/config/load_config.cc +13 -0
- data/src/core/lib/config/load_config.h +6 -0
- data/src/core/lib/debug/event_log.h +1 -1
- data/src/core/lib/debug/stats_data.h +1 -1
- data/src/core/lib/debug/trace.cc +24 -55
- data/src/core/lib/debug/trace.h +3 -1
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +211 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +86 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +354 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +146 -0
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +79 -0
- data/src/core/lib/event_engine/default_event_engine.cc +13 -1
- data/src/core/lib/event_engine/default_event_engine_factory.cc +14 -2
- data/src/core/lib/event_engine/poller.h +2 -2
- data/src/core/lib/event_engine/posix.h +4 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +7 -18
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +9 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +33 -19
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +7 -8
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -1
- data/src/core/lib/event_engine/shim.cc +7 -1
- data/src/core/lib/event_engine/{thread_pool.cc → thread_pool/original_thread_pool.cc} +28 -25
- data/src/core/lib/event_engine/{thread_pool.h → thread_pool/original_thread_pool.h} +11 -15
- data/src/core/lib/event_engine/thread_pool/thread_pool.h +50 -0
- data/src/core/lib/event_engine/{executor/executor.h → thread_pool/thread_pool_factory.cc} +17 -15
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +489 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +249 -0
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +166 -0
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +108 -0
- data/src/core/lib/event_engine/windows/iocp.cc +4 -3
- data/src/core/lib/event_engine/windows/iocp.h +3 -3
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/win_socket.h +4 -4
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -10
- data/src/core/lib/event_engine/windows/windows_endpoint.h +3 -2
- data/src/core/lib/event_engine/windows/windows_engine.cc +19 -17
- data/src/core/lib/event_engine/windows/windows_engine.h +6 -6
- data/src/core/lib/event_engine/windows/windows_listener.cc +3 -3
- data/src/core/lib/event_engine/windows/windows_listener.h +3 -2
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +63 -0
- data/src/core/lib/event_engine/work_queue/basic_work_queue.h +71 -0
- data/src/core/lib/event_engine/work_queue/work_queue.h +62 -0
- data/src/core/lib/experiments/config.cc +38 -7
- data/src/core/lib/experiments/config.h +16 -0
- data/src/core/lib/experiments/experiments.cc +67 -20
- data/src/core/lib/experiments/experiments.h +27 -21
- data/src/core/lib/gpr/log_internal.h +55 -0
- data/src/core/lib/gprpp/crash.cc +10 -0
- data/src/core/lib/gprpp/crash.h +3 -0
- data/src/core/lib/gprpp/per_cpu.cc +33 -0
- data/src/core/lib/gprpp/per_cpu.h +29 -6
- data/src/core/lib/gprpp/time.cc +1 -0
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +10 -8
- data/src/core/lib/iomgr/ev_apple.cc +12 -12
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +10 -3
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +15 -1
- data/src/core/lib/iomgr/iocp_windows.cc +24 -3
- data/src/core/lib/iomgr/iocp_windows.h +11 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -2
- data/src/core/lib/iomgr/socket_windows.cc +61 -7
- data/src/core/lib/iomgr/socket_windows.h +9 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -3
- data/src/core/lib/iomgr/tcp_server_posix.cc +148 -107
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
- data/src/core/lib/json/json.h +2 -166
- data/src/core/lib/json/json_object_loader.cc +8 -9
- data/src/core/lib/json/json_object_loader.h +25 -18
- data/src/core/lib/json/json_reader.cc +13 -6
- data/src/core/lib/json/json_util.cc +6 -11
- data/src/core/lib/json/json_writer.cc +7 -8
- data/src/core/lib/load_balancing/lb_policy.h +13 -0
- data/src/core/lib/load_balancing/lb_policy_registry.cc +2 -1
- data/src/core/lib/matchers/matchers.cc +3 -4
- data/src/core/lib/matchers/matchers.h +2 -1
- data/src/core/lib/promise/activity.cc +5 -0
- data/src/core/lib/promise/activity.h +10 -0
- data/src/core/lib/promise/detail/promise_factory.h +1 -1
- data/src/core/lib/promise/party.cc +31 -13
- data/src/core/lib/promise/party.h +11 -2
- data/src/core/lib/promise/pipe.h +9 -2
- data/src/core/lib/promise/prioritized_race.h +95 -0
- data/src/core/lib/promise/sleep.cc +2 -1
- data/src/core/lib/resolver/server_address.cc +0 -8
- data/src/core/lib/resolver/server_address.h +0 -6
- data/src/core/lib/resource_quota/memory_quota.cc +7 -7
- data/src/core/lib/resource_quota/memory_quota.h +1 -2
- data/src/core/lib/security/authorization/audit_logging.cc +98 -0
- data/src/core/lib/security/authorization/audit_logging.h +73 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +47 -2
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +18 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +36 -4
- data/src/core/lib/security/authorization/rbac_policy.h +19 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +75 -0
- data/src/core/lib/security/authorization/stdout_logger.h +61 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +8 -4
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +8 -18
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +14 -8
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +19 -12
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +4 -2
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +15 -14
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +1 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -5
- data/src/core/lib/security/util/json_util.cc +1 -0
- data/src/core/lib/service_config/service_config_call_data.h +49 -20
- data/src/core/lib/service_config/service_config_impl.cc +2 -1
- data/src/core/lib/surface/call.cc +38 -23
- data/src/core/lib/surface/completion_queue.cc +6 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/batch_builder.cc +15 -12
- data/src/core/lib/transport/batch_builder.h +39 -35
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
- data/src/ruby/ext/grpc/extconf.rb +8 -9
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +10 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +7 -4
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +6 -4
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +5 -9
- data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +31 -22
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +29 -26
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +189 -13
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +31 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +6 -4
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +795 -795
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -5
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +18 -6
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +15 -7
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +24 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +74 -74
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +11 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +12 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +14 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +10 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +23 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +13 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/{hkdf → fipsmodule/hkdf}/hkdf.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +2 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +115 -133
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +12 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +57 -47
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +1 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/polyval.c +27 -28
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +11 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +21 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +5 -288
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +143 -83
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +95 -183
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +71 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +33 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +162 -6
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +18 -0
- data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +18 -11
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +6 -13
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -14
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_lock.c → refcount_no_threads.c} +3 -13
- data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +89 -0
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +77 -0
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_crypt.c +568 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +218 -44
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +35 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +588 -39
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +27 -18
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +17 -39
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +39 -48
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +0 -140
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +72 -23
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -14
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +33 -46
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +3 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +14 -46
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -26
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +17 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +5 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +6 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +32 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +0 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +3 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +28 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +2 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +91 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +149 -20
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +8 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +774 -615
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +42 -10
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +11 -6
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -4
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +24 -16
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +65 -18
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +37 -18
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +187 -193
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +13 -129
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +85 -10
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +17 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +27 -19
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +5 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -2
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_msvc.h +1281 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64_msvc.h +2002 -0
- data/third_party/cares/cares/include/ares.h +23 -1
- data/third_party/cares/cares/{src/lib → include}/ares_nameser.h +9 -7
- data/third_party/cares/cares/include/ares_rules.h +2 -2
- data/third_party/cares/cares/include/ares_version.h +3 -3
- data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +266 -0
- data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +240 -0
- data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +49 -80
- data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +37 -43
- data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +12 -4
- data/third_party/cares/cares/src/lib/ares_data.c +16 -0
- data/third_party/cares/cares/src/lib/ares_data.h +7 -0
- data/third_party/cares/cares/src/lib/ares_destroy.c +8 -0
- data/third_party/cares/cares/src/lib/ares_expand_name.c +17 -6
- data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +1 -0
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +156 -78
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +130 -326
- data/third_party/cares/cares/src/lib/ares_init.c +97 -485
- data/third_party/cares/cares/src/lib/ares_library_init.c +2 -89
- data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +23 -142
- data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +22 -142
- data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +184 -0
- data/third_party/cares/cares/src/lib/ares_private.h +30 -16
- data/third_party/cares/cares/src/lib/ares_process.c +55 -16
- data/third_party/cares/cares/src/lib/ares_query.c +1 -35
- data/third_party/cares/cares/src/lib/ares_rand.c +279 -0
- data/third_party/cares/cares/src/lib/ares_send.c +5 -7
- data/third_party/cares/cares/src/lib/ares_strdup.c +12 -19
- data/third_party/cares/cares/src/lib/ares_strsplit.c +44 -128
- data/third_party/cares/cares/src/lib/ares_strsplit.h +9 -10
- data/third_party/cares/cares/src/lib/inet_net_pton.c +78 -116
- data/third_party/cares/cares/src/tools/ares_getopt.h +53 -0
- metadata +50 -14
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +0 -175
- data/src/core/ext/filters/client_channel/health/health_check_client.h +0 -43
- data/third_party/cares/cares/src/lib/ares_library_init.h +0 -43
@@ -0,0 +1,146 @@
|
|
1
|
+
// Copyright 2023 The gRPC Authors
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
#ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFSTREAM_ENDPOINT_H
|
15
|
+
#define GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFSTREAM_ENDPOINT_H
|
16
|
+
#include <grpc/support/port_platform.h>
|
17
|
+
|
18
|
+
#ifdef GPR_APPLE
|
19
|
+
|
20
|
+
#include <CoreFoundation/CoreFoundation.h>
|
21
|
+
|
22
|
+
#include "absl/strings/str_format.h"
|
23
|
+
|
24
|
+
#include <grpc/event_engine/event_engine.h>
|
25
|
+
|
26
|
+
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
27
|
+
#include "src/core/lib/event_engine/cf_engine/cf_engine.h"
|
28
|
+
#include "src/core/lib/event_engine/cf_engine/cftype_unique_ref.h"
|
29
|
+
#include "src/core/lib/event_engine/posix_engine/lockfree_event.h"
|
30
|
+
#include "src/core/lib/event_engine/tcp_socket_utils.h"
|
31
|
+
#include "src/core/lib/gprpp/host_port.h"
|
32
|
+
#include "src/core/lib/gprpp/ref_counted.h"
|
33
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
34
|
+
|
35
|
+
namespace grpc_event_engine {
|
36
|
+
namespace experimental {
|
37
|
+
|
38
|
+
class CFStreamEndpointImpl
|
39
|
+
: public grpc_core::RefCounted<CFStreamEndpointImpl> {
|
40
|
+
public:
|
41
|
+
CFStreamEndpointImpl(std::shared_ptr<CFEventEngine> engine,
|
42
|
+
MemoryAllocator memory_allocator);
|
43
|
+
~CFStreamEndpointImpl();
|
44
|
+
|
45
|
+
void Shutdown();
|
46
|
+
|
47
|
+
bool Read(absl::AnyInvocable<void(absl::Status)> on_read, SliceBuffer* buffer,
|
48
|
+
const EventEngine::Endpoint::ReadArgs* args);
|
49
|
+
bool Write(absl::AnyInvocable<void(absl::Status)> on_writable,
|
50
|
+
SliceBuffer* data, const EventEngine::Endpoint::WriteArgs* args);
|
51
|
+
|
52
|
+
const EventEngine::ResolvedAddress& GetPeerAddress() const {
|
53
|
+
return peer_address_;
|
54
|
+
}
|
55
|
+
const EventEngine::ResolvedAddress& GetLocalAddress() const {
|
56
|
+
return local_address_;
|
57
|
+
}
|
58
|
+
|
59
|
+
public:
|
60
|
+
void Connect(absl::AnyInvocable<void(absl::Status)> on_connect,
|
61
|
+
EventEngine::ResolvedAddress addr);
|
62
|
+
bool CancelConnect(absl::Status status);
|
63
|
+
|
64
|
+
private:
|
65
|
+
void DoWrite(absl::AnyInvocable<void(absl::Status)> on_writable,
|
66
|
+
SliceBuffer* data);
|
67
|
+
void DoRead(absl::AnyInvocable<void(absl::Status)> on_read,
|
68
|
+
SliceBuffer* buffer);
|
69
|
+
|
70
|
+
private:
|
71
|
+
static void* Retain(void* info) {
|
72
|
+
auto that = static_cast<CFStreamEndpointImpl*>(info);
|
73
|
+
return that->Ref().release();
|
74
|
+
}
|
75
|
+
|
76
|
+
static void Release(void* info) {
|
77
|
+
auto that = static_cast<CFStreamEndpointImpl*>(info);
|
78
|
+
that->Unref();
|
79
|
+
}
|
80
|
+
|
81
|
+
static void ReadCallback(CFReadStreamRef stream, CFStreamEventType type,
|
82
|
+
void* client_callback_info);
|
83
|
+
static void WriteCallback(CFWriteStreamRef stream, CFStreamEventType type,
|
84
|
+
void* client_callback_info);
|
85
|
+
|
86
|
+
private:
|
87
|
+
CFTypeUniqueRef<CFReadStreamRef> cf_read_stream_;
|
88
|
+
CFTypeUniqueRef<CFWriteStreamRef> cf_write_stream_;
|
89
|
+
|
90
|
+
std::shared_ptr<CFEventEngine> engine_;
|
91
|
+
|
92
|
+
EventEngine::ResolvedAddress peer_address_;
|
93
|
+
EventEngine::ResolvedAddress local_address_;
|
94
|
+
std::string peer_address_string_;
|
95
|
+
std::string local_address_string_;
|
96
|
+
MemoryAllocator memory_allocator_;
|
97
|
+
|
98
|
+
LockfreeEvent open_event_;
|
99
|
+
LockfreeEvent read_event_;
|
100
|
+
LockfreeEvent write_event_;
|
101
|
+
};
|
102
|
+
|
103
|
+
class CFStreamEndpoint : public EventEngine::Endpoint {
|
104
|
+
public:
|
105
|
+
CFStreamEndpoint(std::shared_ptr<CFEventEngine> engine,
|
106
|
+
MemoryAllocator memory_allocator) {
|
107
|
+
impl_ = grpc_core::MakeRefCounted<CFStreamEndpointImpl>(
|
108
|
+
std::move(engine), std::move(memory_allocator));
|
109
|
+
}
|
110
|
+
~CFStreamEndpoint() override { impl_->Shutdown(); }
|
111
|
+
|
112
|
+
bool Read(absl::AnyInvocable<void(absl::Status)> on_read, SliceBuffer* buffer,
|
113
|
+
const ReadArgs* args) override {
|
114
|
+
return impl_->Read(std::move(on_read), buffer, args);
|
115
|
+
}
|
116
|
+
bool Write(absl::AnyInvocable<void(absl::Status)> on_writable,
|
117
|
+
SliceBuffer* data, const WriteArgs* args) override {
|
118
|
+
return impl_->Write(std::move(on_writable), data, args);
|
119
|
+
}
|
120
|
+
|
121
|
+
const EventEngine::ResolvedAddress& GetPeerAddress() const override {
|
122
|
+
return impl_->GetPeerAddress();
|
123
|
+
}
|
124
|
+
const EventEngine::ResolvedAddress& GetLocalAddress() const override {
|
125
|
+
return impl_->GetLocalAddress();
|
126
|
+
}
|
127
|
+
|
128
|
+
public:
|
129
|
+
void Connect(absl::AnyInvocable<void(absl::Status)> on_connect,
|
130
|
+
EventEngine::ResolvedAddress addr) {
|
131
|
+
impl_->Connect(std::move(on_connect), std::move(addr));
|
132
|
+
}
|
133
|
+
bool CancelConnect(absl::Status status) {
|
134
|
+
return impl_->CancelConnect(std::move(status));
|
135
|
+
}
|
136
|
+
|
137
|
+
private:
|
138
|
+
grpc_core::RefCountedPtr<CFStreamEndpointImpl> impl_;
|
139
|
+
};
|
140
|
+
|
141
|
+
} // namespace experimental
|
142
|
+
} // namespace grpc_event_engine
|
143
|
+
|
144
|
+
#endif // GPR_APPLE
|
145
|
+
|
146
|
+
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFSTREAM_ENDPOINT_H
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// Copyright 2023 The gRPC Authors
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
#ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFTYPE_UNIQUE_REF_H
|
15
|
+
#define GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFTYPE_UNIQUE_REF_H
|
16
|
+
#include <grpc/support/port_platform.h>
|
17
|
+
|
18
|
+
#ifdef GPR_APPLE
|
19
|
+
|
20
|
+
#include <CoreFoundation/CoreFoundation.h>
|
21
|
+
|
22
|
+
namespace grpc_event_engine {
|
23
|
+
namespace experimental {
|
24
|
+
|
25
|
+
template <typename T>
|
26
|
+
class CFTypeUniqueRef {
|
27
|
+
static_assert(std::is_convertible<T, CFTypeRef>::value,
|
28
|
+
"T should be `CFXxxRef` type");
|
29
|
+
|
30
|
+
public:
|
31
|
+
/* implicit */
|
32
|
+
CFTypeUniqueRef(T cf_type_ref = nullptr) : cf_type_ref_(cf_type_ref) {}
|
33
|
+
~CFTypeUniqueRef() { reset(); }
|
34
|
+
|
35
|
+
CFTypeUniqueRef(CFTypeUniqueRef const&) = delete;
|
36
|
+
CFTypeUniqueRef& operator=(CFTypeUniqueRef const&) = delete;
|
37
|
+
|
38
|
+
CFTypeUniqueRef(CFTypeUniqueRef&& other) : cf_type_ref_(other.release()){};
|
39
|
+
CFTypeUniqueRef& operator=(CFTypeUniqueRef&& other) {
|
40
|
+
reset(other.release());
|
41
|
+
return *this;
|
42
|
+
}
|
43
|
+
|
44
|
+
operator T() { return cf_type_ref_; }
|
45
|
+
|
46
|
+
// Note: this is for passing a CFTypeRef as output parameter to a CF API, the
|
47
|
+
// current ref is released (if any) regardless of whether new value is set
|
48
|
+
T* operator&() {
|
49
|
+
reset();
|
50
|
+
return &cf_type_ref_;
|
51
|
+
}
|
52
|
+
|
53
|
+
T release() {
|
54
|
+
T old = cf_type_ref_;
|
55
|
+
cf_type_ref_ = nullptr;
|
56
|
+
return old;
|
57
|
+
}
|
58
|
+
|
59
|
+
void reset(T other = nullptr) {
|
60
|
+
if (cf_type_ref_ == other) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
T old = cf_type_ref_;
|
64
|
+
cf_type_ref_ = other;
|
65
|
+
if (old) {
|
66
|
+
CFRelease(old);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
private:
|
71
|
+
T cf_type_ref_;
|
72
|
+
};
|
73
|
+
|
74
|
+
} // namespace experimental
|
75
|
+
} // namespace grpc_event_engine
|
76
|
+
|
77
|
+
#endif // GPR_APPLE
|
78
|
+
|
79
|
+
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_CF_ENGINE_CFTYPE_UNIQUE_REF_H
|
@@ -32,6 +32,10 @@
|
|
32
32
|
#include "src/core/lib/gprpp/no_destruct.h"
|
33
33
|
#include "src/core/lib/gprpp/sync.h"
|
34
34
|
|
35
|
+
#ifdef GRPC_MAXIMIZE_THREADYNESS
|
36
|
+
#include "src/core/lib/event_engine/thready_event_engine/thready_event_engine.h" // IWYU pragma: keep
|
37
|
+
#endif
|
38
|
+
|
35
39
|
namespace grpc_event_engine {
|
36
40
|
namespace experimental {
|
37
41
|
|
@@ -57,13 +61,21 @@ void EventEngineFactoryReset() {
|
|
57
61
|
g_event_engine->reset();
|
58
62
|
}
|
59
63
|
|
60
|
-
std::unique_ptr<EventEngine>
|
64
|
+
std::unique_ptr<EventEngine> CreateEventEngineInner() {
|
61
65
|
if (auto* factory = g_event_engine_factory.load()) {
|
62
66
|
return (*factory)();
|
63
67
|
}
|
64
68
|
return DefaultEventEngineFactory();
|
65
69
|
}
|
66
70
|
|
71
|
+
std::unique_ptr<EventEngine> CreateEventEngine() {
|
72
|
+
#ifdef GRPC_MAXIMIZE_THREADYNESS
|
73
|
+
return std::make_unique<ThreadyEventEngine>(CreateEventEngineInner());
|
74
|
+
#else
|
75
|
+
return CreateEventEngineInner();
|
76
|
+
#endif
|
77
|
+
}
|
78
|
+
|
67
79
|
std::shared_ptr<EventEngine> GetDefaultEventEngine(
|
68
80
|
grpc_core::SourceLocation location) {
|
69
81
|
grpc_core::MutexLock lock(&*g_mu);
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
#include <grpc/event_engine/event_engine.h>
|
22
22
|
|
23
|
-
#
|
23
|
+
#if defined(GPR_WINDOWS)
|
24
24
|
#include "src/core/lib/event_engine/windows/windows_engine.h"
|
25
25
|
|
26
26
|
namespace grpc_event_engine {
|
@@ -32,7 +32,19 @@ std::unique_ptr<EventEngine> DefaultEventEngineFactory() {
|
|
32
32
|
|
33
33
|
} // namespace experimental
|
34
34
|
} // namespace grpc_event_engine
|
35
|
-
#
|
35
|
+
#elif defined(GRPC_CFSTREAM)
|
36
|
+
#include "src/core/lib/event_engine/cf_engine/cf_engine.h"
|
37
|
+
|
38
|
+
namespace grpc_event_engine {
|
39
|
+
namespace experimental {
|
40
|
+
|
41
|
+
std::unique_ptr<EventEngine> DefaultEventEngineFactory() {
|
42
|
+
return std::make_unique<CFEventEngine>();
|
43
|
+
}
|
44
|
+
|
45
|
+
} // namespace experimental
|
46
|
+
} // namespace grpc_event_engine
|
47
|
+
#else
|
36
48
|
#include "src/core/lib/event_engine/posix_engine/posix_engine.h"
|
37
49
|
|
38
50
|
namespace grpc_event_engine {
|
@@ -43,12 +43,12 @@ class Poller {
|
|
43
43
|
// * Poller::WorkResult::kKicked if it was Kicked. A poller that was Kicked
|
44
44
|
// may still process some events and if so, it may have run the
|
45
45
|
// schedule_poll_again callback function synchronously. When the poller
|
46
|
-
// returns Poller::WorkResult::kKicked
|
46
|
+
// returns Poller::WorkResult::kKicked it's up to the user to determine
|
47
47
|
// if the schedule_poll_again callback has run or not.
|
48
48
|
// * Poller::WorkResult::kDeadlineExceeded if timeout occurred. The
|
49
49
|
// schedule_poll_again callback is not run in this case.
|
50
50
|
// * Poller::WorkResult::kOk, otherwise indicating that the
|
51
|
-
// schedule_poll_again callback function was run
|
51
|
+
// schedule_poll_again callback function was run synchronously before some
|
52
52
|
// events were processed.
|
53
53
|
virtual WorkResult Work(EventEngine::Duration timeout,
|
54
54
|
absl::FunctionRef<void()> schedule_poll_again) = 0;
|
@@ -37,6 +37,10 @@ class PosixEndpointWithFdSupport : public EventEngine::Endpoint {
|
|
37
37
|
/// Returns the file descriptor associated with the posix endpoint.
|
38
38
|
virtual int GetWrappedFd() = 0;
|
39
39
|
|
40
|
+
/// Returns if the Endpoint supports tracking events from errmsg queues on
|
41
|
+
/// posix systems.
|
42
|
+
virtual bool CanTrackErrors() = 0;
|
43
|
+
|
40
44
|
/// Shutdown the endpoint. This function call should trigger execution of
|
41
45
|
/// any pending endpoint Read/Write callbacks with appropriate error
|
42
46
|
/// absl::Status. After this function call any subsequent endpoint
|
@@ -86,7 +86,7 @@ void LockfreeEvent::DestroyEvent() {
|
|
86
86
|
// pattern to prevent error retention in a deleted object
|
87
87
|
} while (!state_.compare_exchange_strong(curr, kShutdownBit,
|
88
88
|
std::memory_order_acq_rel,
|
89
|
-
std::
|
89
|
+
std::memory_order_acquire));
|
90
90
|
}
|
91
91
|
|
92
92
|
void LockfreeEvent::NotifyOn(PosixEngineClosure* closure) {
|
@@ -103,14 +103,9 @@ void LockfreeEvent::NotifyOn(PosixEngineClosure* closure) {
|
|
103
103
|
case kClosureNotReady: {
|
104
104
|
// kClosureNotReady -> <closure>.
|
105
105
|
|
106
|
-
// We're guaranteed by API that there's an acquire barrier before here,
|
107
|
-
// so there's no need to double-dip and this can be a release-only.
|
108
|
-
|
109
|
-
// The release itself pairs with the acquire half of a set_ready full
|
110
|
-
// barrier.
|
111
106
|
if (state_.compare_exchange_strong(
|
112
107
|
curr, reinterpret_cast<intptr_t>(closure),
|
113
|
-
std::memory_order_acq_rel, std::
|
108
|
+
std::memory_order_acq_rel, std::memory_order_acquire)) {
|
114
109
|
return; // Successful. Return
|
115
110
|
}
|
116
111
|
|
@@ -122,13 +117,9 @@ void LockfreeEvent::NotifyOn(PosixEngineClosure* closure) {
|
|
122
117
|
// successful. If not, the state most likely transitioned to shutdown.
|
123
118
|
// We should retry.
|
124
119
|
|
125
|
-
// This can be a no-barrier cas since the state is being transitioned to
|
126
|
-
// kClosureNotReady; set_ready and set_shutdown do not schedule any
|
127
|
-
// closure when transitioning out of CLOSURE_NO_READY state (i.e there
|
128
|
-
// is no other code that needs to 'happen-after' this)
|
129
120
|
if (state_.compare_exchange_strong(curr, kClosureNotReady,
|
130
121
|
std::memory_order_acq_rel,
|
131
|
-
std::
|
122
|
+
std::memory_order_acquire)) {
|
132
123
|
scheduler_->Run(closure);
|
133
124
|
return; // Successful. Return.
|
134
125
|
}
|
@@ -175,7 +166,7 @@ bool LockfreeEvent::SetShutdown(absl::Status shutdown_error) {
|
|
175
166
|
// doesn't need a barrier
|
176
167
|
if (state_.compare_exchange_strong(curr, new_state,
|
177
168
|
std::memory_order_acq_rel,
|
178
|
-
std::
|
169
|
+
std::memory_order_acquire)) {
|
179
170
|
return true; // early out
|
180
171
|
}
|
181
172
|
break; // retry
|
@@ -196,7 +187,7 @@ bool LockfreeEvent::SetShutdown(absl::Status shutdown_error) {
|
|
196
187
|
// loading the shutdown state.
|
197
188
|
if (state_.compare_exchange_strong(curr, new_state,
|
198
189
|
std::memory_order_acq_rel,
|
199
|
-
std::
|
190
|
+
std::memory_order_acquire)) {
|
200
191
|
auto closure = reinterpret_cast<PosixEngineClosure*>(curr);
|
201
192
|
closure->SetStatus(shutdown_error);
|
202
193
|
scheduler_->Run(closure);
|
@@ -225,11 +216,9 @@ void LockfreeEvent::SetReady() {
|
|
225
216
|
}
|
226
217
|
|
227
218
|
case kClosureNotReady: {
|
228
|
-
// No barrier required as we're transitioning to a state that does not
|
229
|
-
// involve a closure
|
230
219
|
if (state_.compare_exchange_strong(curr, kClosureReady,
|
231
220
|
std::memory_order_acq_rel,
|
232
|
-
std::
|
221
|
+
std::memory_order_acquire)) {
|
233
222
|
return; // early out
|
234
223
|
}
|
235
224
|
break; // retry
|
@@ -242,7 +231,7 @@ void LockfreeEvent::SetReady() {
|
|
242
231
|
return;
|
243
232
|
} else if (state_.compare_exchange_strong(curr, kClosureNotReady,
|
244
233
|
std::memory_order_acq_rel,
|
245
|
-
std::
|
234
|
+
std::memory_order_acquire)) {
|
246
235
|
// Full cas: acquire pairs with this cas' release in the event of a
|
247
236
|
// spurious set_ready; release pairs with this or the acquire in
|
248
237
|
// notify_on (or set_shutdown)
|
@@ -493,6 +493,8 @@ class PosixEndpointImpl : public grpc_core::RefCounted<PosixEndpointImpl> {
|
|
493
493
|
|
494
494
|
int GetWrappedFd() { return fd_; }
|
495
495
|
|
496
|
+
bool CanTrackErrors() const { return poller_->CanTrackErrors(); }
|
497
|
+
|
496
498
|
void MaybeShutdown(
|
497
499
|
absl::Status why,
|
498
500
|
absl::AnyInvocable<void(absl::StatusOr<int> release_fd)> on_release_fd);
|
@@ -635,6 +637,8 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
|
|
635
637
|
|
636
638
|
int GetWrappedFd() override { return impl_->GetWrappedFd(); }
|
637
639
|
|
640
|
+
bool CanTrackErrors() override { return impl_->CanTrackErrors(); }
|
641
|
+
|
638
642
|
void Shutdown(absl::AnyInvocable<void(absl::StatusOr<int> release_fd)>
|
639
643
|
on_release_fd) override {
|
640
644
|
if (!shutdown_.exchange(true, std::memory_order_acq_rel)) {
|
@@ -691,6 +695,11 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
|
|
691
695
|
"PosixEndpoint::GetWrappedFd not supported on this platform");
|
692
696
|
}
|
693
697
|
|
698
|
+
bool CanTrackErrors() override {
|
699
|
+
grpc_core::Crash(
|
700
|
+
"PosixEndpoint::CanTrackErrors not supported on this platform");
|
701
|
+
}
|
702
|
+
|
694
703
|
void Shutdown(absl::AnyInvocable<void(absl::StatusOr<int> release_fd)>
|
695
704
|
on_release_fd) override {
|
696
705
|
grpc_core::Crash("PosixEndpoint::Shutdown not supported on this platform");
|
@@ -44,6 +44,7 @@
|
|
44
44
|
#include "src/core/lib/event_engine/tcp_socket_utils.h"
|
45
45
|
#include "src/core/lib/event_engine/trace.h"
|
46
46
|
#include "src/core/lib/event_engine/utils.h"
|
47
|
+
#include "src/core/lib/gpr/useful.h"
|
47
48
|
#include "src/core/lib/gprpp/crash.h"
|
48
49
|
#include "src/core/lib/gprpp/sync.h"
|
49
50
|
|
@@ -60,6 +61,15 @@
|
|
60
61
|
|
61
62
|
// IWYU pragma: no_include <ratio>
|
62
63
|
|
64
|
+
// TODO(eryu): remove this GRPC_CFSTREAM condition when the CFEngine is ready.
|
65
|
+
// The posix poller currently crashes iOS.
|
66
|
+
#if defined(GRPC_POSIX_SOCKET_TCP) && !defined(GRPC_CFSTREAM) && \
|
67
|
+
!defined(GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER)
|
68
|
+
#define GRPC_PLATFORM_SUPPORTS_POSIX_POLLING true
|
69
|
+
#else
|
70
|
+
#define GRPC_PLATFORM_SUPPORTS_POSIX_POLLING false
|
71
|
+
#endif
|
72
|
+
|
63
73
|
using namespace std::chrono_literals;
|
64
74
|
|
65
75
|
namespace grpc_event_engine {
|
@@ -333,15 +343,18 @@ PosixEnginePollerManager::~PosixEnginePollerManager() {
|
|
333
343
|
|
334
344
|
PosixEventEngine::PosixEventEngine(PosixEventPoller* poller)
|
335
345
|
: connection_shards_(std::max(2 * gpr_cpu_num_cores(), 1u)),
|
336
|
-
executor_(
|
346
|
+
executor_(MakeThreadPool(grpc_core::Clamp(gpr_cpu_num_cores(), 2u, 16u))),
|
337
347
|
timer_manager_(executor_) {
|
348
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
338
349
|
poller_manager_ = std::make_shared<PosixEnginePollerManager>(poller);
|
350
|
+
#endif
|
339
351
|
}
|
340
352
|
|
341
353
|
PosixEventEngine::PosixEventEngine()
|
342
354
|
: connection_shards_(std::max(2 * gpr_cpu_num_cores(), 1u)),
|
343
|
-
executor_(
|
355
|
+
executor_(MakeThreadPool(grpc_core::Clamp(gpr_cpu_num_cores(), 2u, 16u))),
|
344
356
|
timer_manager_(executor_) {
|
357
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
345
358
|
poller_manager_ = std::make_shared<PosixEnginePollerManager>(executor_);
|
346
359
|
// The threadpool must be instantiated after the poller otherwise, the
|
347
360
|
// process will deadlock when forking.
|
@@ -350,6 +363,7 @@ PosixEventEngine::PosixEventEngine()
|
|
350
363
|
PollerWorkInternal(poller_manager);
|
351
364
|
});
|
352
365
|
}
|
366
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
353
367
|
}
|
354
368
|
|
355
369
|
void PosixEventEngine::PollerWorkInternal(
|
@@ -420,11 +434,11 @@ PosixEventEngine::~PosixEventEngine() {
|
|
420
434
|
GPR_ASSERT(GPR_LIKELY(known_handles_.empty()));
|
421
435
|
}
|
422
436
|
timer_manager_.Shutdown();
|
423
|
-
#
|
437
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
424
438
|
if (poller_manager_ != nullptr) {
|
425
439
|
poller_manager_->TriggerShutdown();
|
426
440
|
}
|
427
|
-
#endif //
|
441
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
428
442
|
executor_->Quiesce();
|
429
443
|
}
|
430
444
|
|
@@ -481,7 +495,7 @@ std::unique_ptr<EventEngine::DNSResolver> PosixEventEngine::GetDNSResolver(
|
|
481
495
|
bool PosixEventEngine::IsWorkerThread() { grpc_core::Crash("unimplemented"); }
|
482
496
|
|
483
497
|
bool PosixEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) {
|
484
|
-
#
|
498
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
485
499
|
int connection_handle = handle.keys[0];
|
486
500
|
if (connection_handle <= 0) {
|
487
501
|
return false;
|
@@ -530,17 +544,17 @@ bool PosixEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) {
|
|
530
544
|
delete ac;
|
531
545
|
}
|
532
546
|
return connection_cancel_success;
|
533
|
-
#else //
|
547
|
+
#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
534
548
|
grpc_core::Crash(
|
535
549
|
"EventEngine::CancelConnect is not supported on this platform");
|
536
|
-
#endif //
|
550
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
537
551
|
}
|
538
552
|
|
539
553
|
EventEngine::ConnectionHandle PosixEventEngine::Connect(
|
540
554
|
OnConnectCallback on_connect, const ResolvedAddress& addr,
|
541
555
|
const EndpointConfig& args, MemoryAllocator memory_allocator,
|
542
556
|
Duration timeout) {
|
543
|
-
#
|
557
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
544
558
|
GPR_ASSERT(poller_manager_ != nullptr);
|
545
559
|
PosixTcpOptions options = TcpOptionsFromEndpointConfig(args);
|
546
560
|
absl::StatusOr<PosixSocketWrapper::PosixSocketCreateResult> socket =
|
@@ -553,16 +567,16 @@ EventEngine::ConnectionHandle PosixEventEngine::Connect(
|
|
553
567
|
return ConnectInternal((*socket).sock, std::move(on_connect),
|
554
568
|
(*socket).mapped_target_addr,
|
555
569
|
std::move(memory_allocator), options, timeout);
|
556
|
-
#else //
|
570
|
+
#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
557
571
|
grpc_core::Crash("EventEngine::Connect is not supported on this platform");
|
558
|
-
#endif //
|
572
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
559
573
|
}
|
560
574
|
|
561
575
|
std::unique_ptr<PosixEndpointWithFdSupport>
|
562
576
|
PosixEventEngine::CreatePosixEndpointFromFd(int fd,
|
563
577
|
const EndpointConfig& config,
|
564
578
|
MemoryAllocator memory_allocator) {
|
565
|
-
#
|
579
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
566
580
|
GPR_DEBUG_ASSERT(fd > 0);
|
567
581
|
PosixEventPoller* poller = poller_manager_->Poller();
|
568
582
|
GPR_DEBUG_ASSERT(poller != nullptr);
|
@@ -571,11 +585,11 @@ PosixEventEngine::CreatePosixEndpointFromFd(int fd,
|
|
571
585
|
return CreatePosixEndpoint(handle, nullptr, shared_from_this(),
|
572
586
|
std::move(memory_allocator),
|
573
587
|
TcpOptionsFromEndpointConfig(config));
|
574
|
-
#else //
|
588
|
+
#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
575
589
|
grpc_core::Crash(
|
576
590
|
"PosixEventEngine::CreatePosixEndpointFromFd is not supported on "
|
577
591
|
"this platform");
|
578
|
-
#endif //
|
592
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
579
593
|
}
|
580
594
|
|
581
595
|
absl::StatusOr<std::unique_ptr<EventEngine::Listener>>
|
@@ -584,7 +598,7 @@ PosixEventEngine::CreateListener(
|
|
584
598
|
absl::AnyInvocable<void(absl::Status)> on_shutdown,
|
585
599
|
const EndpointConfig& config,
|
586
600
|
std::unique_ptr<MemoryAllocatorFactory> memory_allocator_factory) {
|
587
|
-
#
|
601
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
588
602
|
PosixEventEngineWithFdSupport::PosixAcceptCallback posix_on_accept =
|
589
603
|
[on_accept_cb = std::move(on_accept)](
|
590
604
|
int /*listener_fd*/, std::unique_ptr<EventEngine::Endpoint> ep,
|
@@ -596,10 +610,10 @@ PosixEventEngine::CreateListener(
|
|
596
610
|
std::move(posix_on_accept), std::move(on_shutdown), config,
|
597
611
|
std::move(memory_allocator_factory), poller_manager_->Poller(),
|
598
612
|
shared_from_this());
|
599
|
-
#else //
|
613
|
+
#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
600
614
|
grpc_core::Crash(
|
601
615
|
"EventEngine::CreateListener is not supported on this platform");
|
602
|
-
#endif //
|
616
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
603
617
|
}
|
604
618
|
|
605
619
|
absl::StatusOr<std::unique_ptr<PosixListenerWithFdSupport>>
|
@@ -608,15 +622,15 @@ PosixEventEngine::CreatePosixListener(
|
|
608
622
|
absl::AnyInvocable<void(absl::Status)> on_shutdown,
|
609
623
|
const EndpointConfig& config,
|
610
624
|
std::unique_ptr<MemoryAllocatorFactory> memory_allocator_factory) {
|
611
|
-
#
|
625
|
+
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
612
626
|
return std::make_unique<PosixEngineListener>(
|
613
627
|
std::move(on_accept), std::move(on_shutdown), config,
|
614
628
|
std::move(memory_allocator_factory), poller_manager_->Poller(),
|
615
629
|
shared_from_this());
|
616
|
-
#else //
|
630
|
+
#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
617
631
|
grpc_core::Crash(
|
618
632
|
"EventEngine::CreateListener is not supported on this platform");
|
619
|
-
#endif //
|
633
|
+
#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
|
620
634
|
}
|
621
635
|
|
622
636
|
} // namespace experimental
|
@@ -38,7 +38,7 @@
|
|
38
38
|
#include "src/core/lib/event_engine/posix.h"
|
39
39
|
#include "src/core/lib/event_engine/posix_engine/event_poller.h"
|
40
40
|
#include "src/core/lib/event_engine/posix_engine/timer_manager.h"
|
41
|
-
#include "src/core/lib/event_engine/thread_pool.h"
|
41
|
+
#include "src/core/lib/event_engine/thread_pool/thread_pool.h"
|
42
42
|
#include "src/core/lib/gprpp/sync.h"
|
43
43
|
#include "src/core/lib/iomgr/port.h"
|
44
44
|
#include "src/core/lib/surface/init_internally.h"
|
@@ -64,7 +64,7 @@ PosixEngineListenerImpl::PosixEngineListenerImpl(
|
|
64
64
|
absl::StatusOr<int> PosixEngineListenerImpl::Bind(
|
65
65
|
const EventEngine::ResolvedAddress& addr,
|
66
66
|
PosixListenerWithFdSupport::OnPosixBindNewFdCallback on_bind_new_fd) {
|
67
|
-
|
67
|
+
grpc_core::MutexLock lock(&this->mu_);
|
68
68
|
if (this->started_) {
|
69
69
|
return absl::FailedPreconditionError(
|
70
70
|
"Listener is already started, ports can no longer be bound");
|
@@ -254,7 +254,7 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::Shutdown() {
|
|
254
254
|
}
|
255
255
|
|
256
256
|
absl::Status PosixEngineListenerImpl::Start() {
|
257
|
-
|
257
|
+
grpc_core::MutexLock lock(&this->mu_);
|
258
258
|
// Start each asynchronous acceptor.
|
259
259
|
GPR_ASSERT(!this->started_);
|
260
260
|
this->started_ = true;
|
@@ -267,7 +267,7 @@ absl::Status PosixEngineListenerImpl::Start() {
|
|
267
267
|
void PosixEngineListenerImpl::TriggerShutdown() {
|
268
268
|
// This would get invoked from the destructor of the parent
|
269
269
|
// PosixEngineListener object.
|
270
|
-
|
270
|
+
grpc_core::MutexLock lock(&this->mu_);
|
271
271
|
for (auto it = acceptors_.begin(); it != acceptors_.end(); it++) {
|
272
272
|
// Trigger shutdown of each asynchronous acceptor. This in-turn calls
|
273
273
|
// ShutdownHandle on the associated poller event handle. It may also
|
@@ -278,7 +278,7 @@ void PosixEngineListenerImpl::TriggerShutdown() {
|
|
278
278
|
}
|
279
279
|
|
280
280
|
PosixEngineListenerImpl::~PosixEngineListenerImpl() {
|
281
|
-
// This should get invoked only after all the
|
281
|
+
// This should get invoked only after all the AsyncConnectionAcceptors have
|
282
282
|
// been destroyed. This is because each AsyncConnectionAcceptor has a
|
283
283
|
// shared_ptr ref to the parent PosixEngineListenerImpl.
|
284
284
|
if (on_shutdown_ != nullptr) {
|