grpc 1.49.0.pre1-x86_64-linux → 1.50.0.pre1-x86_64-linux
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 +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +19 -16
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +32 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
// Copyright 2020 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
|
+
|
15
|
+
#ifndef GRPC_CORE_LIB_GPRPP_VALIDATION_ERRORS_H
|
16
|
+
#define GRPC_CORE_LIB_GPRPP_VALIDATION_ERRORS_H
|
17
|
+
|
18
|
+
#include <grpc/support/port_platform.h>
|
19
|
+
|
20
|
+
#include <stddef.h>
|
21
|
+
|
22
|
+
#include <map>
|
23
|
+
#include <string>
|
24
|
+
#include <vector>
|
25
|
+
|
26
|
+
#include "absl/status/status.h"
|
27
|
+
#include "absl/strings/string_view.h"
|
28
|
+
|
29
|
+
namespace grpc_core {
|
30
|
+
|
31
|
+
// Tracks errors that occur during validation of a data structure (e.g.,
|
32
|
+
// a JSON object or protobuf message). Errors are tracked based on
|
33
|
+
// which field they are associated with. If at least one error occurs
|
34
|
+
// during validation, the validation failed.
|
35
|
+
//
|
36
|
+
// Example usage:
|
37
|
+
//
|
38
|
+
// absl::StatusOr<std::string> GetFooBar(const Json::Object& json) {
|
39
|
+
// ValidationErrors errors;
|
40
|
+
// {
|
41
|
+
// ValidationErrors::ScopedField field("foo");
|
42
|
+
// auto it = json.object_value().find("foo");
|
43
|
+
// if (it == json.object_value().end()) {
|
44
|
+
// errors.AddError("field not present");
|
45
|
+
// } else if (it->second.type() != Json::Type::OBJECT) {
|
46
|
+
// errors.AddError("must be a JSON object");
|
47
|
+
// } else {
|
48
|
+
// const Json& foo = it->second;
|
49
|
+
// ValidationErrors::ScopedField field(".bar");
|
50
|
+
// auto it = foo.object_value().find("bar");
|
51
|
+
// if (it == json.object_value().end()) {
|
52
|
+
// errors.AddError("field not present");
|
53
|
+
// } else if (it->second.type() != Json::Type::STRING) {
|
54
|
+
// errors.AddError("must be a JSON string");
|
55
|
+
// } else {
|
56
|
+
// return it->second.string_value();
|
57
|
+
// }
|
58
|
+
// }
|
59
|
+
// }
|
60
|
+
// return errors.status("errors validating foo.bar");
|
61
|
+
// }
|
62
|
+
class ValidationErrors {
|
63
|
+
public:
|
64
|
+
// Pushes a field name onto the stack at construction and pops it off
|
65
|
+
// of the stack at destruction.
|
66
|
+
class ScopedField {
|
67
|
+
public:
|
68
|
+
ScopedField(ValidationErrors* errors, absl::string_view field_name)
|
69
|
+
: errors_(errors) {
|
70
|
+
errors_->PushField(field_name);
|
71
|
+
}
|
72
|
+
~ScopedField() { errors_->PopField(); }
|
73
|
+
|
74
|
+
private:
|
75
|
+
ValidationErrors* errors_;
|
76
|
+
};
|
77
|
+
|
78
|
+
// Records that we've encountered an error associated with the current
|
79
|
+
// field.
|
80
|
+
void AddError(absl::string_view error) GPR_ATTRIBUTE_NOINLINE;
|
81
|
+
|
82
|
+
// Returns true if the current field has errors.
|
83
|
+
bool FieldHasErrors() const GPR_ATTRIBUTE_NOINLINE;
|
84
|
+
|
85
|
+
// Returns the resulting status of parsing.
|
86
|
+
absl::Status status(absl::string_view prefix) const;
|
87
|
+
|
88
|
+
// Returns true if there are no errors.
|
89
|
+
bool ok() const { return field_errors_.empty(); }
|
90
|
+
|
91
|
+
size_t size() const { return field_errors_.size(); }
|
92
|
+
|
93
|
+
private:
|
94
|
+
// Pushes a field name onto the stack.
|
95
|
+
void PushField(absl::string_view ext) GPR_ATTRIBUTE_NOINLINE;
|
96
|
+
// Pops a field name off of the stack.
|
97
|
+
void PopField() GPR_ATTRIBUTE_NOINLINE;
|
98
|
+
|
99
|
+
// Errors that we have encountered so far, keyed by field name.
|
100
|
+
// TODO(roth): If we don't actually have any fields for which we
|
101
|
+
// report more than one error, simplify this data structure.
|
102
|
+
std::map<std::string /*field_name*/, std::vector<std::string>> field_errors_;
|
103
|
+
// Stack of field names indicating the field that we are currently
|
104
|
+
// validating.
|
105
|
+
std::vector<std::string> fields_;
|
106
|
+
};
|
107
|
+
|
108
|
+
} // namespace grpc_core
|
109
|
+
|
110
|
+
#endif // GRPC_CORE_LIB_GPRPP_VALIDATION_ERRORS_H
|
@@ -16,8 +16,8 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
#ifndef
|
20
|
-
#define
|
19
|
+
#ifndef GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_H
|
20
|
+
#define GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_H
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
@@ -50,4 +50,4 @@ class ProxyMapperInterface {
|
|
50
50
|
|
51
51
|
} // namespace grpc_core
|
52
52
|
|
53
|
-
#endif /*
|
53
|
+
#endif /* GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_H */
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#include <grpc/support/port_platform.h>
|
20
20
|
|
21
|
-
#include "src/core/
|
21
|
+
#include "src/core/lib/handshaker/proxy_mapper_registry.h"
|
22
22
|
|
23
23
|
#include <algorithm>
|
24
24
|
#include <memory>
|
@@ -29,46 +29,25 @@
|
|
29
29
|
|
30
30
|
namespace grpc_core {
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
using ProxyMapperList = std::vector<std::unique_ptr<ProxyMapperInterface>>;
|
35
|
-
ProxyMapperList* g_proxy_mapper_list;
|
36
|
-
|
37
|
-
} // namespace
|
38
|
-
|
39
|
-
void ProxyMapperRegistry::Init() {
|
40
|
-
if (g_proxy_mapper_list == nullptr) {
|
41
|
-
g_proxy_mapper_list = new ProxyMapperList();
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
void ProxyMapperRegistry::Shutdown() {
|
46
|
-
delete g_proxy_mapper_list;
|
47
|
-
// Clean up in case we re-initialze later.
|
48
|
-
// TODO(roth): This should ideally live in Init(). However, if we did this
|
49
|
-
// there, then we would do it AFTER we start registering proxy mappers from
|
50
|
-
// third-party plugins, so they'd never show up (and would leak memory).
|
51
|
-
// We probably need some sort of dependency system for plugins to fix
|
52
|
-
// this.
|
53
|
-
g_proxy_mapper_list = nullptr;
|
54
|
-
}
|
55
|
-
|
56
|
-
void ProxyMapperRegistry::Register(
|
32
|
+
void ProxyMapperRegistry::Builder::Register(
|
57
33
|
bool at_start, std::unique_ptr<ProxyMapperInterface> mapper) {
|
58
|
-
Init();
|
59
34
|
if (at_start) {
|
60
|
-
|
61
|
-
std::move(mapper));
|
35
|
+
mappers_.insert(mappers_.begin(), std::move(mapper));
|
62
36
|
} else {
|
63
|
-
|
37
|
+
mappers_.emplace_back(std::move(mapper));
|
64
38
|
}
|
65
39
|
}
|
66
40
|
|
41
|
+
ProxyMapperRegistry ProxyMapperRegistry::Builder::Build() {
|
42
|
+
ProxyMapperRegistry registry;
|
43
|
+
registry.mappers_ = std::move(mappers_);
|
44
|
+
return registry;
|
45
|
+
}
|
46
|
+
|
67
47
|
absl::optional<std::string> ProxyMapperRegistry::MapName(
|
68
|
-
absl::string_view server_uri, ChannelArgs* args) {
|
69
|
-
Init();
|
48
|
+
absl::string_view server_uri, ChannelArgs* args) const {
|
70
49
|
ChannelArgs args_backup = *args;
|
71
|
-
for (const auto& mapper :
|
50
|
+
for (const auto& mapper : mappers_) {
|
72
51
|
*args = args_backup;
|
73
52
|
auto r = mapper->MapName(server_uri, args);
|
74
53
|
if (r.has_value()) return r;
|
@@ -78,10 +57,9 @@ absl::optional<std::string> ProxyMapperRegistry::MapName(
|
|
78
57
|
}
|
79
58
|
|
80
59
|
absl::optional<grpc_resolved_address> ProxyMapperRegistry::MapAddress(
|
81
|
-
const grpc_resolved_address& address, ChannelArgs* args) {
|
82
|
-
Init();
|
60
|
+
const grpc_resolved_address& address, ChannelArgs* args) const {
|
83
61
|
ChannelArgs args_backup = *args;
|
84
|
-
for (const auto& mapper :
|
62
|
+
for (const auto& mapper : mappers_) {
|
85
63
|
*args = args_backup;
|
86
64
|
auto r = mapper->MapAddress(address, args);
|
87
65
|
if (r.has_value()) return r;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2017 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_REGISTRY_H
|
20
|
+
#define GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_REGISTRY_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include <algorithm>
|
25
|
+
#include <memory>
|
26
|
+
#include <string>
|
27
|
+
#include <vector>
|
28
|
+
|
29
|
+
#include "absl/strings/string_view.h"
|
30
|
+
#include "absl/types/optional.h"
|
31
|
+
|
32
|
+
#include "src/core/lib/channel/channel_args.h"
|
33
|
+
#include "src/core/lib/handshaker/proxy_mapper.h"
|
34
|
+
#include "src/core/lib/iomgr/resolved_address.h"
|
35
|
+
|
36
|
+
namespace grpc_core {
|
37
|
+
|
38
|
+
class ProxyMapperRegistry {
|
39
|
+
using ProxyMapperList = std::vector<std::unique_ptr<ProxyMapperInterface>>;
|
40
|
+
|
41
|
+
public:
|
42
|
+
class Builder {
|
43
|
+
public:
|
44
|
+
/// Registers a new proxy mapper.
|
45
|
+
/// If \a at_start is true, the new mapper will be at the beginning of
|
46
|
+
/// the list. Otherwise, it will be added to the end.
|
47
|
+
void Register(bool at_start, std::unique_ptr<ProxyMapperInterface> mapper);
|
48
|
+
|
49
|
+
ProxyMapperRegistry Build();
|
50
|
+
|
51
|
+
private:
|
52
|
+
ProxyMapperList mappers_;
|
53
|
+
};
|
54
|
+
|
55
|
+
~ProxyMapperRegistry() = default;
|
56
|
+
ProxyMapperRegistry(const ProxyMapperRegistry&) = delete;
|
57
|
+
ProxyMapperRegistry& operator=(const ProxyMapperRegistry&) = delete;
|
58
|
+
ProxyMapperRegistry(ProxyMapperRegistry&&) = default;
|
59
|
+
ProxyMapperRegistry& operator=(ProxyMapperRegistry&&) = default;
|
60
|
+
|
61
|
+
absl::optional<std::string> MapName(absl::string_view server_uri,
|
62
|
+
ChannelArgs* args) const;
|
63
|
+
|
64
|
+
absl::optional<grpc_resolved_address> MapAddress(
|
65
|
+
const grpc_resolved_address& address, ChannelArgs* args) const;
|
66
|
+
|
67
|
+
private:
|
68
|
+
ProxyMapperRegistry() = default;
|
69
|
+
|
70
|
+
ProxyMapperList mappers_;
|
71
|
+
};
|
72
|
+
|
73
|
+
} // namespace grpc_core
|
74
|
+
|
75
|
+
#endif /* GRPC_CORE_LIB_HANDSHAKER_PROXY_MAPPER_REGISTRY_H */
|
@@ -25,7 +25,6 @@
|
|
25
25
|
#include <grpc/support/log.h>
|
26
26
|
|
27
27
|
#include "src/core/lib/debug/stats.h"
|
28
|
-
#include "src/core/lib/profiling/timers.h"
|
29
28
|
|
30
29
|
namespace grpc_core {
|
31
30
|
|
@@ -113,7 +112,6 @@ void CallCombiner::ScheduleClosure(grpc_closure* closure,
|
|
113
112
|
|
114
113
|
void CallCombiner::Start(grpc_closure* closure, grpc_error_handle error,
|
115
114
|
DEBUG_ARGS const char* reason) {
|
116
|
-
GPR_TIMER_SCOPE("CallCombiner::Start", 0);
|
117
115
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
|
118
116
|
gpr_log(GPR_INFO,
|
119
117
|
"==> CallCombiner::Start() [%p] closure=%p [" DEBUG_FMT_STR
|
@@ -127,10 +125,7 @@ void CallCombiner::Start(grpc_closure* closure, grpc_error_handle error,
|
|
127
125
|
gpr_log(GPR_INFO, " size: %" PRIdPTR " -> %" PRIdPTR, prev_size,
|
128
126
|
prev_size + 1);
|
129
127
|
}
|
130
|
-
GRPC_STATS_INC_CALL_COMBINER_LOCKS_SCHEDULED_ITEMS();
|
131
128
|
if (prev_size == 0) {
|
132
|
-
GRPC_STATS_INC_CALL_COMBINER_LOCKS_INITIATED();
|
133
|
-
GPR_TIMER_MARK("call_combiner_initiate", 0);
|
134
129
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
|
135
130
|
gpr_log(GPR_INFO, " EXECUTING IMMEDIATELY");
|
136
131
|
}
|
@@ -148,7 +143,6 @@ void CallCombiner::Start(grpc_closure* closure, grpc_error_handle error,
|
|
148
143
|
}
|
149
144
|
|
150
145
|
void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
|
151
|
-
GPR_TIMER_SCOPE("CallCombiner::Stop", 0);
|
152
146
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_combiner_trace)) {
|
153
147
|
gpr_log(GPR_INFO, "==> CallCombiner::Stop() [%p] [" DEBUG_FMT_STR "%s]",
|
154
148
|
this DEBUG_FMT_ARGS, reason);
|
@@ -192,7 +186,6 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) {
|
|
192
186
|
}
|
193
187
|
|
194
188
|
void CallCombiner::SetNotifyOnCancel(grpc_closure* closure) {
|
195
|
-
GRPC_STATS_INC_CALL_COMBINER_SET_NOTIFY_ON_CANCEL();
|
196
189
|
while (true) {
|
197
190
|
// Decode original state.
|
198
191
|
gpr_atm original_state = gpr_atm_acq_load(&cancel_state_);
|
@@ -235,7 +228,6 @@ void CallCombiner::SetNotifyOnCancel(grpc_closure* closure) {
|
|
235
228
|
}
|
236
229
|
|
237
230
|
void CallCombiner::Cancel(grpc_error_handle error) {
|
238
|
-
GRPC_STATS_INC_CALL_COMBINER_CANCELLED();
|
239
231
|
intptr_t status_ptr = internal::StatusAllocHeapPtr(error);
|
240
232
|
gpr_atm new_state = kErrorBit | status_ptr;
|
241
233
|
while (true) {
|
@@ -35,6 +35,7 @@
|
|
35
35
|
#include <grpc/support/alloc.h>
|
36
36
|
#include <grpc/support/log.h>
|
37
37
|
|
38
|
+
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
|
38
39
|
#include "src/core/lib/gpr/string.h"
|
39
40
|
#include "src/core/lib/iomgr/endpoint_pair.h"
|
40
41
|
#include "src/core/lib/iomgr/socket_utils_posix.h"
|
@@ -60,17 +61,20 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
|
|
60
61
|
create_sockets(sv);
|
61
62
|
grpc_core::ExecCtx exec_ctx;
|
62
63
|
std::string final_name = absl::StrCat(name, ":client");
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
auto new_args = grpc_core::CoreConfiguration::Get()
|
65
|
+
.channel_args_preconditioning()
|
66
|
+
.PreconditionChannelArgs(args);
|
67
|
+
p.client = grpc_tcp_create(
|
68
|
+
grpc_fd_create(sv[1], final_name.c_str(), false),
|
69
|
+
TcpOptionsFromEndpointConfig(
|
70
|
+
grpc_event_engine::experimental::ChannelArgsEndpointConfig(new_args)),
|
71
|
+
"socketpair-server");
|
70
72
|
final_name = absl::StrCat(name, ":server");
|
71
|
-
p.server = grpc_tcp_create(
|
72
|
-
|
73
|
-
|
73
|
+
p.server = grpc_tcp_create(
|
74
|
+
grpc_fd_create(sv[0], final_name.c_str(), false),
|
75
|
+
TcpOptionsFromEndpointConfig(
|
76
|
+
grpc_event_engine::experimental::ChannelArgsEndpointConfig(new_args)),
|
77
|
+
"socketpair-client");
|
74
78
|
return p;
|
75
79
|
}
|
76
80
|
|
@@ -77,9 +77,9 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(
|
|
77
77
|
create_sockets(sv);
|
78
78
|
grpc_core::ExecCtx exec_ctx;
|
79
79
|
p.client = grpc_tcp_create(grpc_winsocket_create(sv[1], "endpoint:client"),
|
80
|
-
|
80
|
+
"endpoint:server");
|
81
81
|
p.server = grpc_tcp_create(grpc_winsocket_create(sv[0], "endpoint:server"),
|
82
|
-
|
82
|
+
"endpoint:client");
|
83
83
|
return p;
|
84
84
|
}
|
85
85
|
|
@@ -57,7 +57,6 @@
|
|
57
57
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
58
58
|
#include "src/core/lib/iomgr/lockfree_event.h"
|
59
59
|
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
|
60
|
-
#include "src/core/lib/profiling/timers.h"
|
61
60
|
|
62
61
|
static grpc_wakeup_fd global_wakeup_fd;
|
63
62
|
|
@@ -586,25 +585,20 @@ static void pollset_destroy(grpc_pollset* pollset) {
|
|
586
585
|
}
|
587
586
|
|
588
587
|
static grpc_error_handle pollset_kick_all(grpc_pollset* pollset) {
|
589
|
-
GPR_TIMER_SCOPE("pollset_kick_all", 0);
|
590
588
|
grpc_error_handle error = GRPC_ERROR_NONE;
|
591
589
|
if (pollset->root_worker != nullptr) {
|
592
590
|
grpc_pollset_worker* worker = pollset->root_worker;
|
593
591
|
do {
|
594
|
-
GRPC_STATS_INC_POLLSET_KICK();
|
595
592
|
switch (worker->state) {
|
596
593
|
case KICKED:
|
597
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
598
594
|
break;
|
599
595
|
case UNKICKED:
|
600
596
|
SET_KICK_STATE(worker, KICKED);
|
601
597
|
if (worker->initialized_cv) {
|
602
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
603
598
|
gpr_cv_signal(&worker->cv);
|
604
599
|
}
|
605
600
|
break;
|
606
601
|
case DESIGNATED_POLLER:
|
607
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
608
602
|
SET_KICK_STATE(worker, KICKED);
|
609
603
|
append_error(&error, grpc_wakeup_fd_wakeup(&global_wakeup_fd),
|
610
604
|
"pollset_kick_all");
|
@@ -622,7 +616,6 @@ static grpc_error_handle pollset_kick_all(grpc_pollset* pollset) {
|
|
622
616
|
static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
|
623
617
|
if (pollset->shutdown_closure != nullptr && pollset->root_worker == nullptr &&
|
624
618
|
pollset->begin_refs == 0) {
|
625
|
-
GPR_TIMER_MARK("pollset_finish_shutdown", 0);
|
626
619
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, pollset->shutdown_closure,
|
627
620
|
GRPC_ERROR_NONE);
|
628
621
|
pollset->shutdown_closure = nullptr;
|
@@ -630,7 +623,6 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
|
|
630
623
|
}
|
631
624
|
|
632
625
|
static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
|
633
|
-
GPR_TIMER_SCOPE("pollset_shutdown", 0);
|
634
626
|
GPR_ASSERT(pollset->shutdown_closure == nullptr);
|
635
627
|
GPR_ASSERT(!pollset->shutting_down);
|
636
628
|
pollset->shutdown_closure = closure;
|
@@ -641,7 +633,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
|
|
641
633
|
|
642
634
|
static int poll_deadline_to_millis_timeout(grpc_core::Timestamp millis) {
|
643
635
|
if (millis == grpc_core::Timestamp::InfFuture()) return -1;
|
644
|
-
int64_t delta = (millis - grpc_core::
|
636
|
+
int64_t delta = (millis - grpc_core::Timestamp::Now()).millis();
|
645
637
|
if (delta > INT_MAX) {
|
646
638
|
return INT_MAX;
|
647
639
|
} else if (delta < 0) {
|
@@ -660,8 +652,6 @@ static int poll_deadline_to_millis_timeout(grpc_core::Timestamp millis) {
|
|
660
652
|
called by g_active_poller thread. So there is no need for synchronization
|
661
653
|
when accessing fields in g_epoll_set */
|
662
654
|
static grpc_error_handle process_epoll_events(grpc_pollset* /*pollset*/) {
|
663
|
-
GPR_TIMER_SCOPE("process_epoll_events", 0);
|
664
|
-
|
665
655
|
static const char* err_desc = "process_events";
|
666
656
|
grpc_error_handle error = GRPC_ERROR_NONE;
|
667
657
|
long num_events = gpr_atm_acq_load(&g_epoll_set.num_events);
|
@@ -713,15 +703,12 @@ static grpc_error_handle process_epoll_events(grpc_pollset* /*pollset*/) {
|
|
713
703
|
no need for any synchronization when accesing fields in g_epoll_set */
|
714
704
|
static grpc_error_handle do_epoll_wait(grpc_pollset* ps,
|
715
705
|
grpc_core::Timestamp deadline) {
|
716
|
-
GPR_TIMER_SCOPE("do_epoll_wait", 0);
|
717
|
-
|
718
706
|
int r;
|
719
707
|
int timeout = poll_deadline_to_millis_timeout(deadline);
|
720
708
|
if (timeout != 0) {
|
721
709
|
GRPC_SCHEDULING_START_BLOCKING_REGION;
|
722
710
|
}
|
723
711
|
do {
|
724
|
-
GRPC_STATS_INC_SYSCALL_POLL();
|
725
712
|
r = epoll_wait(g_epoll_set.epfd, g_epoll_set.events, MAX_EPOLL_EVENTS,
|
726
713
|
timeout);
|
727
714
|
} while (r < 0 && errno == EINTR);
|
@@ -731,8 +718,6 @@ static grpc_error_handle do_epoll_wait(grpc_pollset* ps,
|
|
731
718
|
|
732
719
|
if (r < 0) return GRPC_OS_ERROR(errno, "epoll_wait");
|
733
720
|
|
734
|
-
GRPC_STATS_INC_POLL_EVENTS_RETURNED(r);
|
735
|
-
|
736
721
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
737
722
|
gpr_log(GPR_INFO, "ps: %p poll got %d events", ps, r);
|
738
723
|
}
|
@@ -746,7 +731,6 @@ static grpc_error_handle do_epoll_wait(grpc_pollset* ps,
|
|
746
731
|
static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
747
732
|
grpc_pollset_worker** worker_hdl,
|
748
733
|
grpc_core::Timestamp deadline) {
|
749
|
-
GPR_TIMER_SCOPE("begin_worker", 0);
|
750
734
|
if (worker_hdl != nullptr) *worker_hdl = worker;
|
751
735
|
worker->initialized_cv = false;
|
752
736
|
SET_KICK_STATE(worker, UNKICKED);
|
@@ -869,7 +853,6 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
|
869
853
|
|
870
854
|
static bool check_neighborhood_for_available_poller(
|
871
855
|
pollset_neighborhood* neighborhood) {
|
872
|
-
GPR_TIMER_SCOPE("check_neighborhood_for_available_poller", 0);
|
873
856
|
bool found_worker = false;
|
874
857
|
do {
|
875
858
|
grpc_pollset* inspect = neighborhood->active_root;
|
@@ -892,8 +875,6 @@ static bool check_neighborhood_for_available_poller(
|
|
892
875
|
}
|
893
876
|
SET_KICK_STATE(inspect_worker, DESIGNATED_POLLER);
|
894
877
|
if (inspect_worker->initialized_cv) {
|
895
|
-
GPR_TIMER_MARK("signal worker", 0);
|
896
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
897
878
|
gpr_cv_signal(&inspect_worker->cv);
|
898
879
|
}
|
899
880
|
} else {
|
@@ -934,7 +915,6 @@ static bool check_neighborhood_for_available_poller(
|
|
934
915
|
|
935
916
|
static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
936
917
|
grpc_pollset_worker** worker_hdl) {
|
937
|
-
GPR_TIMER_SCOPE("end_worker", 0);
|
938
918
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
939
919
|
gpr_log(GPR_INFO, "PS:%p END_WORKER:%p", pollset, worker);
|
940
920
|
}
|
@@ -952,7 +932,6 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
|
952
932
|
GPR_ASSERT(worker->next->initialized_cv);
|
953
933
|
gpr_atm_no_barrier_store(&g_active_poller, (gpr_atm)worker->next);
|
954
934
|
SET_KICK_STATE(worker->next, DESIGNATED_POLLER);
|
955
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
956
935
|
gpr_cv_signal(&worker->next->cv);
|
957
936
|
if (grpc_core::ExecCtx::Get()->HasWork()) {
|
958
937
|
gpr_mu_unlock(&pollset->mu);
|
@@ -1014,7 +993,6 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
|
|
1014
993
|
static grpc_error_handle pollset_work(grpc_pollset* ps,
|
1015
994
|
grpc_pollset_worker** worker_hdl,
|
1016
995
|
grpc_core::Timestamp deadline) {
|
1017
|
-
GPR_TIMER_SCOPE("pollset_work", 0);
|
1018
996
|
grpc_pollset_worker worker;
|
1019
997
|
grpc_error_handle error = GRPC_ERROR_NONE;
|
1020
998
|
static const char* err_desc = "pollset_work";
|
@@ -1064,8 +1042,6 @@ static grpc_error_handle pollset_work(grpc_pollset* ps,
|
|
1064
1042
|
|
1065
1043
|
static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
1066
1044
|
grpc_pollset_worker* specific_worker) {
|
1067
|
-
GPR_TIMER_SCOPE("pollset_kick", 0);
|
1068
|
-
GRPC_STATS_INC_POLLSET_KICK();
|
1069
1045
|
grpc_error_handle ret_err = GRPC_ERROR_NONE;
|
1070
1046
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1071
1047
|
std::vector<std::string> log;
|
@@ -1091,7 +1067,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1091
1067
|
if (g_current_thread_pollset != pollset) {
|
1092
1068
|
grpc_pollset_worker* root_worker = pollset->root_worker;
|
1093
1069
|
if (root_worker == nullptr) {
|
1094
|
-
GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER();
|
1095
1070
|
pollset->kicked_without_poller = true;
|
1096
1071
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1097
1072
|
gpr_log(GPR_INFO, " .. kicked_without_poller");
|
@@ -1100,14 +1075,12 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1100
1075
|
}
|
1101
1076
|
grpc_pollset_worker* next_worker = root_worker->next;
|
1102
1077
|
if (root_worker->state == KICKED) {
|
1103
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1104
1078
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1105
1079
|
gpr_log(GPR_INFO, " .. already kicked %p", root_worker);
|
1106
1080
|
}
|
1107
1081
|
SET_KICK_STATE(root_worker, KICKED);
|
1108
1082
|
goto done;
|
1109
1083
|
} else if (next_worker->state == KICKED) {
|
1110
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1111
1084
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1112
1085
|
gpr_log(GPR_INFO, " .. already kicked %p", next_worker);
|
1113
1086
|
}
|
@@ -1118,7 +1091,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1118
1091
|
root_worker ==
|
1119
1092
|
reinterpret_cast<grpc_pollset_worker*>(
|
1120
1093
|
gpr_atm_no_barrier_load(&g_active_poller))) {
|
1121
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1122
1094
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1123
1095
|
gpr_log(GPR_INFO, " .. kicked %p", root_worker);
|
1124
1096
|
}
|
@@ -1126,7 +1098,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1126
1098
|
ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd);
|
1127
1099
|
goto done;
|
1128
1100
|
} else if (next_worker->state == UNKICKED) {
|
1129
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1130
1101
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1131
1102
|
gpr_log(GPR_INFO, " .. kicked %p", next_worker);
|
1132
1103
|
}
|
@@ -1144,12 +1115,10 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1144
1115
|
}
|
1145
1116
|
SET_KICK_STATE(root_worker, KICKED);
|
1146
1117
|
if (root_worker->initialized_cv) {
|
1147
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1148
1118
|
gpr_cv_signal(&root_worker->cv);
|
1149
1119
|
}
|
1150
1120
|
goto done;
|
1151
1121
|
} else {
|
1152
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1153
1122
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1154
1123
|
gpr_log(GPR_INFO, " .. non-root poller %p (root=%p)", next_worker,
|
1155
1124
|
root_worker);
|
@@ -1159,13 +1128,11 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1159
1128
|
goto done;
|
1160
1129
|
}
|
1161
1130
|
} else {
|
1162
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1163
1131
|
GPR_ASSERT(next_worker->state == KICKED);
|
1164
1132
|
SET_KICK_STATE(next_worker, KICKED);
|
1165
1133
|
goto done;
|
1166
1134
|
}
|
1167
1135
|
} else {
|
1168
|
-
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD();
|
1169
1136
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1170
1137
|
gpr_log(GPR_INFO, " .. kicked while waking up");
|
1171
1138
|
}
|
@@ -1181,7 +1148,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1181
1148
|
}
|
1182
1149
|
goto done;
|
1183
1150
|
} else if (g_current_thread_worker == specific_worker) {
|
1184
|
-
GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD();
|
1185
1151
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1186
1152
|
gpr_log(GPR_INFO, " .. mark %p kicked", specific_worker);
|
1187
1153
|
}
|
@@ -1190,7 +1156,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1190
1156
|
} else if (specific_worker ==
|
1191
1157
|
reinterpret_cast<grpc_pollset_worker*>(
|
1192
1158
|
gpr_atm_no_barrier_load(&g_active_poller))) {
|
1193
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
|
1194
1159
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1195
1160
|
gpr_log(GPR_INFO, " .. kick active poller");
|
1196
1161
|
}
|
@@ -1198,7 +1163,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1198
1163
|
ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd);
|
1199
1164
|
goto done;
|
1200
1165
|
} else if (specific_worker->initialized_cv) {
|
1201
|
-
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV();
|
1202
1166
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1203
1167
|
gpr_log(GPR_INFO, " .. kick waiting worker");
|
1204
1168
|
}
|
@@ -1206,7 +1170,6 @@ static grpc_error_handle pollset_kick(grpc_pollset* pollset,
|
|
1206
1170
|
gpr_cv_signal(&specific_worker->cv);
|
1207
1171
|
goto done;
|
1208
1172
|
} else {
|
1209
|
-
GRPC_STATS_INC_POLLSET_KICKED_AGAIN();
|
1210
1173
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1211
1174
|
gpr_log(GPR_INFO, " .. kick non-waiting worker");
|
1212
1175
|
}
|