grpc 1.49.0.pre1 → 1.50.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +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/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 +31 -17
- 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
@@ -0,0 +1,60 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2020 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
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
|
22
|
+
|
23
|
+
#include <string.h>
|
24
|
+
|
25
|
+
#include <algorithm>
|
26
|
+
#include <utility>
|
27
|
+
#include <vector>
|
28
|
+
|
29
|
+
#include <grpc/support/log.h>
|
30
|
+
|
31
|
+
namespace grpc_core {
|
32
|
+
|
33
|
+
void CertificateProviderRegistry::Builder::RegisterCertificateProviderFactory(
|
34
|
+
std::unique_ptr<CertificateProviderFactory> factory) {
|
35
|
+
gpr_log(GPR_DEBUG, "registering certificate provider factory for \"%s\"",
|
36
|
+
factory->name());
|
37
|
+
for (size_t i = 0; i < factories_.size(); ++i) {
|
38
|
+
GPR_ASSERT(strcmp(factories_[i]->name(), factory->name()) != 0);
|
39
|
+
}
|
40
|
+
factories_.push_back(std::move(factory));
|
41
|
+
}
|
42
|
+
|
43
|
+
CertificateProviderRegistry CertificateProviderRegistry::Builder::Build() {
|
44
|
+
CertificateProviderRegistry r;
|
45
|
+
r.factories_ = std::move(factories_);
|
46
|
+
return r;
|
47
|
+
}
|
48
|
+
|
49
|
+
CertificateProviderFactory*
|
50
|
+
CertificateProviderRegistry::LookupCertificateProviderFactory(
|
51
|
+
absl::string_view name) const {
|
52
|
+
for (size_t i = 0; i < factories_.size(); ++i) {
|
53
|
+
if (name == factories_[i]->name()) {
|
54
|
+
return factories_[i].get();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return nullptr;
|
58
|
+
}
|
59
|
+
|
60
|
+
} // namespace grpc_core
|
@@ -0,0 +1,70 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Copyright 2020 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_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
|
20
|
+
#define GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
|
21
|
+
|
22
|
+
#include <grpc/support/port_platform.h>
|
23
|
+
|
24
|
+
#include <memory>
|
25
|
+
#include <vector>
|
26
|
+
|
27
|
+
#include "absl/strings/string_view.h"
|
28
|
+
|
29
|
+
#include "src/core/lib/security/certificate_provider/certificate_provider_factory.h"
|
30
|
+
|
31
|
+
namespace grpc_core {
|
32
|
+
|
33
|
+
// Global registry for all the certificate provider plugins.
|
34
|
+
class CertificateProviderRegistry {
|
35
|
+
public:
|
36
|
+
class Builder {
|
37
|
+
public:
|
38
|
+
// Register a provider with the registry. Can only be called after calling
|
39
|
+
// InitRegistry(). The key of the factory is extracted from factory
|
40
|
+
// parameter with method CertificateProviderFactory::name. If the same key
|
41
|
+
// is registered twice, an exception is raised.
|
42
|
+
void RegisterCertificateProviderFactory(
|
43
|
+
std::unique_ptr<CertificateProviderFactory> factory);
|
44
|
+
|
45
|
+
CertificateProviderRegistry Build();
|
46
|
+
|
47
|
+
private:
|
48
|
+
std::vector<std::unique_ptr<CertificateProviderFactory>> factories_;
|
49
|
+
};
|
50
|
+
|
51
|
+
CertificateProviderRegistry(const CertificateProviderRegistry&) = delete;
|
52
|
+
CertificateProviderRegistry& operator=(const CertificateProviderRegistry&) =
|
53
|
+
delete;
|
54
|
+
CertificateProviderRegistry(CertificateProviderRegistry&&) = default;
|
55
|
+
CertificateProviderRegistry& operator=(CertificateProviderRegistry&&) =
|
56
|
+
default;
|
57
|
+
|
58
|
+
// Returns the factory for the plugin keyed by name.
|
59
|
+
CertificateProviderFactory* LookupCertificateProviderFactory(
|
60
|
+
absl::string_view name) const;
|
61
|
+
|
62
|
+
private:
|
63
|
+
CertificateProviderRegistry() = default;
|
64
|
+
|
65
|
+
std::vector<std::unique_ptr<CertificateProviderFactory>> factories_;
|
66
|
+
};
|
67
|
+
|
68
|
+
} // namespace grpc_core
|
69
|
+
|
70
|
+
#endif // GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
|
@@ -32,6 +32,7 @@
|
|
32
32
|
#include "src/core/lib/security/credentials/channel_creds_registry.h"
|
33
33
|
#include "src/core/lib/security/credentials/credentials.h"
|
34
34
|
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
|
35
|
+
#include "src/core/lib/security/credentials/google_default/google_default_credentials.h" // IWYU pragma: keep
|
35
36
|
|
36
37
|
namespace grpc_core {
|
37
38
|
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#include "absl/strings/str_format.h"
|
30
30
|
#include "absl/strings/str_replace.h"
|
31
31
|
#include "absl/strings/string_view.h"
|
32
|
+
#include "absl/types/optional.h"
|
32
33
|
|
33
34
|
#include <grpc/grpc.h>
|
34
35
|
#include <grpc/grpc_security.h>
|
@@ -36,8 +37,7 @@
|
|
36
37
|
#include <grpc/support/log.h>
|
37
38
|
#include <grpc/support/string_util.h>
|
38
39
|
|
39
|
-
#include "src/core/lib/
|
40
|
-
#include "src/core/lib/gprpp/memory.h"
|
40
|
+
#include "src/core/lib/gprpp/env.h"
|
41
41
|
#include "src/core/lib/http/httpcli_ssl_credentials.h"
|
42
42
|
#include "src/core/lib/iomgr/closure.h"
|
43
43
|
#include "src/core/lib/json/json.h"
|
@@ -237,12 +237,12 @@ void AwsExternalAccountCredentials::AddMetadataRequestHeaders(
|
|
237
237
|
}
|
238
238
|
|
239
239
|
void AwsExternalAccountCredentials::RetrieveRegion() {
|
240
|
-
|
241
|
-
if (region_from_env
|
242
|
-
region_from_env =
|
240
|
+
auto region_from_env = GetEnv(kRegionEnvVar);
|
241
|
+
if (!region_from_env.has_value()) {
|
242
|
+
region_from_env = GetEnv(kDefaultRegionEnvVar);
|
243
243
|
}
|
244
|
-
if (region_from_env
|
245
|
-
region_ = std::
|
244
|
+
if (region_from_env.has_value()) {
|
245
|
+
region_ = std::move(*region_from_env);
|
246
246
|
if (url_.empty()) {
|
247
247
|
RetrieveSigningKeys();
|
248
248
|
} else {
|
@@ -350,15 +350,14 @@ void AwsExternalAccountCredentials::OnRetrieveRoleNameInternal(
|
|
350
350
|
}
|
351
351
|
|
352
352
|
void AwsExternalAccountCredentials::RetrieveSigningKeys() {
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
token_ = std::string(token_from_env.get());
|
353
|
+
auto access_key_id_from_env = GetEnv(kAccessKeyIdEnvVar);
|
354
|
+
auto secret_access_key_from_env = GetEnv(kSecretAccessKeyEnvVar);
|
355
|
+
auto token_from_env = GetEnv(kSessionTokenEnvVar);
|
356
|
+
if (access_key_id_from_env.has_value() &&
|
357
|
+
secret_access_key_from_env.has_value() && token_from_env.has_value()) {
|
358
|
+
access_key_id_ = std::move(*access_key_id_from_env);
|
359
|
+
secret_access_key_ = std::move(*secret_access_key_from_env);
|
360
|
+
token_ = std::move(*token_from_env);
|
362
361
|
BuildSubjectToken();
|
363
362
|
return;
|
364
363
|
}
|
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "src/core/lib/security/credentials/external/external_account_credentials.h"
|
20
20
|
|
21
|
+
#include <stdint.h>
|
21
22
|
#include <string.h>
|
22
23
|
|
23
24
|
#include <algorithm>
|
@@ -509,7 +510,7 @@ void ExternalAccountCredentials::OnImpersenateServiceAccountInternal(
|
|
509
510
|
"Invalid expire time of service account impersonation response."));
|
510
511
|
return;
|
511
512
|
}
|
512
|
-
|
513
|
+
int64_t expire_in = (t - absl::Now()) / absl::Seconds(1);
|
513
514
|
std::string body = absl::StrFormat(
|
514
515
|
"{\"access_token\":\"%s\",\"expires_in\":%d,\"token_type\":\"Bearer\"}",
|
515
516
|
access_token, expire_in);
|
@@ -21,23 +21,20 @@
|
|
21
21
|
#include <string>
|
22
22
|
|
23
23
|
#include "absl/strings/str_cat.h"
|
24
|
+
#include "absl/types/optional.h"
|
24
25
|
|
25
|
-
#include <grpc/support/alloc.h>
|
26
26
|
#include <grpc/support/log.h>
|
27
27
|
|
28
|
-
#include "src/core/lib/
|
28
|
+
#include "src/core/lib/gprpp/env.h"
|
29
29
|
#include "src/core/lib/security/credentials/credentials.h"
|
30
30
|
#include "src/core/lib/security/credentials/google_default/google_default_credentials.h"
|
31
31
|
|
32
32
|
std::string grpc_get_well_known_google_credentials_file_path_impl(void) {
|
33
|
-
|
34
|
-
if (base
|
33
|
+
auto base = grpc_core::GetEnv(GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR);
|
34
|
+
if (!base.has_value()) {
|
35
35
|
gpr_log(GPR_ERROR, "Could not get " GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR
|
36
36
|
" environment variable.");
|
37
37
|
return "";
|
38
38
|
}
|
39
|
-
|
40
|
-
absl::StrCat(base, "/", GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX);
|
41
|
-
gpr_free(base);
|
42
|
-
return result;
|
39
|
+
return absl::StrCat(*base, "/", GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX);
|
43
40
|
}
|
@@ -44,7 +44,7 @@
|
|
44
44
|
#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h"
|
45
45
|
#include "src/core/lib/channel/channel_args.h"
|
46
46
|
#include "src/core/lib/debug/trace.h"
|
47
|
-
#include "src/core/lib/
|
47
|
+
#include "src/core/lib/gprpp/env.h"
|
48
48
|
#include "src/core/lib/gprpp/host_port.h"
|
49
49
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
50
50
|
#include "src/core/lib/gprpp/sync.h"
|
@@ -54,6 +54,7 @@
|
|
54
54
|
#include "src/core/lib/iomgr/closure.h"
|
55
55
|
#include "src/core/lib/iomgr/error.h"
|
56
56
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
57
|
+
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
57
58
|
#include "src/core/lib/iomgr/load_file.h"
|
58
59
|
#include "src/core/lib/iomgr/polling_entity.h"
|
59
60
|
#include "src/core/lib/iomgr/pollset.h"
|
@@ -217,7 +218,7 @@ static int is_metadata_server_reachable() {
|
|
217
218
|
GPR_ASSERT(uri.ok()); // params are hardcoded
|
218
219
|
auto http_request = grpc_core::HttpRequest::Get(
|
219
220
|
std::move(*uri), nullptr /* channel args */, &detector.pollent, &request,
|
220
|
-
grpc_core::
|
221
|
+
grpc_core::Timestamp::Now() + max_detection_delay,
|
221
222
|
GRPC_CLOSURE_CREATE(on_metadata_server_detection_http_response, &detector,
|
222
223
|
grpc_schedule_on_exec_ctx),
|
223
224
|
&detector.response,
|
@@ -398,10 +399,9 @@ static grpc_core::RefCountedPtr<grpc_call_credentials> make_default_call_creds(
|
|
398
399
|
grpc_error_handle err;
|
399
400
|
|
400
401
|
/* First, try the environment variable. */
|
401
|
-
|
402
|
-
if (path_from_env
|
403
|
-
err = create_default_creds_from_path(path_from_env, &call_creds);
|
404
|
-
gpr_free(path_from_env);
|
402
|
+
auto path_from_env = grpc_core::GetEnv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR);
|
403
|
+
if (path_from_env.has_value()) {
|
404
|
+
err = create_default_creds_from_path(*path_from_env, &call_creds);
|
405
405
|
if (GRPC_ERROR_IS_NONE(err)) return call_creds;
|
406
406
|
*error = grpc_error_add_child(*error, err);
|
407
407
|
}
|
@@ -59,6 +59,7 @@
|
|
59
59
|
#include "src/core/lib/iomgr/closure.h"
|
60
60
|
#include "src/core/lib/iomgr/error.h"
|
61
61
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
62
|
+
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
62
63
|
#include "src/core/lib/iomgr/polling_entity.h"
|
63
64
|
#include "src/core/lib/security/credentials/credentials.h"
|
64
65
|
#include "src/core/lib/slice/b64.h"
|
@@ -732,7 +733,7 @@ static void on_openid_config_retrieved(void* user_data,
|
|
732
733
|
}
|
733
734
|
ctx->http_request = grpc_core::HttpRequest::Get(
|
734
735
|
std::move(*uri), nullptr /* channel args */, &ctx->pollent, &req,
|
735
|
-
grpc_core::
|
736
|
+
grpc_core::Timestamp::Now() + grpc_jwt_verifier_max_delay,
|
736
737
|
GRPC_CLOSURE_CREATE(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx),
|
737
738
|
&ctx->responses[HTTP_RESPONSE_KEYS],
|
738
739
|
grpc_core::CreateHttpRequestSSLCredentials());
|
@@ -863,7 +864,7 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) {
|
|
863
864
|
}
|
864
865
|
ctx->http_request = grpc_core::HttpRequest::Get(
|
865
866
|
std::move(*uri), nullptr /* channel args */, &ctx->pollent, &req,
|
866
|
-
grpc_core::
|
867
|
+
grpc_core::Timestamp::Now() + grpc_jwt_verifier_max_delay, http_cb,
|
867
868
|
&ctx->responses[rsp_idx], grpc_core::CreateHttpRequestSSLCredentials());
|
868
869
|
ctx->http_request->Start();
|
869
870
|
gpr_free(host);
|
@@ -49,7 +49,6 @@
|
|
49
49
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
50
50
|
#include "src/core/lib/http/httpcli_ssl_credentials.h"
|
51
51
|
#include "src/core/lib/iomgr/error.h"
|
52
|
-
#include "src/core/lib/iomgr/exec_ctx.h"
|
53
52
|
#include "src/core/lib/iomgr/load_file.h"
|
54
53
|
#include "src/core/lib/iomgr/pollset_set.h"
|
55
54
|
#include "src/core/lib/json/json.h"
|
@@ -335,7 +334,7 @@ grpc_oauth2_token_fetcher_credentials::GetRequestMetadata(
|
|
335
334
|
if (start_fetch) {
|
336
335
|
fetch_oauth2(new grpc_credentials_metadata_request(Ref()), &pollent_,
|
337
336
|
on_oauth2_token_fetcher_http_response,
|
338
|
-
grpc_core::
|
337
|
+
grpc_core::Timestamp::Now() + refresh_threshold);
|
339
338
|
}
|
340
339
|
return
|
341
340
|
[pending_request]()
|
@@ -120,7 +120,7 @@ gpr_timespec TimeoutSecondsToDeadline(int64_t seconds) {
|
|
120
120
|
|
121
121
|
FileWatcherCertificateProvider::FileWatcherCertificateProvider(
|
122
122
|
std::string private_key_path, std::string identity_certificate_path,
|
123
|
-
std::string root_cert_path,
|
123
|
+
std::string root_cert_path, int64_t refresh_interval_sec)
|
124
124
|
: private_key_path_(std::move(private_key_path)),
|
125
125
|
identity_certificate_path_(std::move(identity_certificate_path)),
|
126
126
|
root_cert_path_(std::move(root_cert_path)),
|
@@ -402,7 +402,8 @@ absl::StatusOr<bool> PrivateKeyAndCertificateMatch(
|
|
402
402
|
if (cert_chain.empty()) {
|
403
403
|
return absl::InvalidArgumentError("Certificate string is empty.");
|
404
404
|
}
|
405
|
-
BIO* cert_bio =
|
405
|
+
BIO* cert_bio =
|
406
|
+
BIO_new_mem_buf(cert_chain.data(), static_cast<int>(cert_chain.size()));
|
406
407
|
if (cert_bio == nullptr) {
|
407
408
|
return absl::InvalidArgumentError(
|
408
409
|
"Conversion from certificate string to BIO failed.");
|
@@ -422,7 +423,7 @@ absl::StatusOr<bool> PrivateKeyAndCertificateMatch(
|
|
422
423
|
"Extraction of public key from x.509 certificate failed.");
|
423
424
|
}
|
424
425
|
BIO* private_key_bio =
|
425
|
-
BIO_new_mem_buf(private_key.data(), private_key.size());
|
426
|
+
BIO_new_mem_buf(private_key.data(), static_cast<int>(private_key.size()));
|
426
427
|
if (private_key_bio == nullptr) {
|
427
428
|
EVP_PKEY_free(public_evp_pkey);
|
428
429
|
return absl::InvalidArgumentError(
|
@@ -19,6 +19,8 @@
|
|
19
19
|
|
20
20
|
#include <grpc/support/port_platform.h>
|
21
21
|
|
22
|
+
#include <stdint.h>
|
23
|
+
|
22
24
|
#include <map>
|
23
25
|
#include <string>
|
24
26
|
|
@@ -139,7 +141,7 @@ class FileWatcherCertificateProvider final
|
|
139
141
|
FileWatcherCertificateProvider(std::string private_key_path,
|
140
142
|
std::string identity_certificate_path,
|
141
143
|
std::string root_cert_path,
|
142
|
-
|
144
|
+
int64_t refresh_interval_sec);
|
143
145
|
|
144
146
|
~FileWatcherCertificateProvider() override;
|
145
147
|
|
@@ -176,7 +178,7 @@ class FileWatcherCertificateProvider final
|
|
176
178
|
std::string private_key_path_;
|
177
179
|
std::string identity_certificate_path_;
|
178
180
|
std::string root_cert_path_;
|
179
|
-
|
181
|
+
int64_t refresh_interval_sec_ = 0;
|
180
182
|
|
181
183
|
RefCountedPtr<grpc_tls_certificate_distributor> distributor_;
|
182
184
|
Thread refresh_thread_;
|
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
#include "src/core/lib/security/credentials/tls/tls_utils.h"
|
22
22
|
|
23
|
+
#include <stddef.h>
|
24
|
+
|
23
25
|
#include "absl/strings/ascii.h"
|
24
26
|
#include "absl/strings/match.h"
|
25
27
|
#include "absl/strings/str_cat.h"
|
@@ -83,7 +85,7 @@ bool VerifySubjectAlternativeName(absl::string_view subject_alternative_name,
|
|
83
85
|
return false;
|
84
86
|
}
|
85
87
|
if (!absl::EndsWith(normalized_matcher, suffix)) return false;
|
86
|
-
|
88
|
+
size_t suffix_start_index = normalized_matcher.length() - suffix.length();
|
87
89
|
// Asterisk matching across domain labels is not permitted.
|
88
90
|
return suffix_start_index <= 0 /* should not happen */ ||
|
89
91
|
normalized_matcher.find_last_of('.', suffix_start_index - 1) ==
|
@@ -37,11 +37,14 @@
|
|
37
37
|
#include "src/core/lib/channel/channel_stack.h"
|
38
38
|
#include "src/core/lib/channel/context.h"
|
39
39
|
#include "src/core/lib/channel/promise_based_filter.h"
|
40
|
+
#include "src/core/lib/channel/status_util.h"
|
40
41
|
#include "src/core/lib/gprpp/debug_location.h"
|
41
42
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
42
43
|
#include "src/core/lib/promise/arena_promise.h"
|
43
44
|
#include "src/core/lib/promise/context.h"
|
45
|
+
#include "src/core/lib/promise/detail/basic_seq.h"
|
44
46
|
#include "src/core/lib/promise/promise.h"
|
47
|
+
#include "src/core/lib/promise/seq.h"
|
45
48
|
#include "src/core/lib/promise/try_seq.h"
|
46
49
|
#include "src/core/lib/resource_quota/arena.h"
|
47
50
|
#include "src/core/lib/security/context/security_context.h"
|
@@ -157,7 +160,15 @@ ArenaPromise<absl::StatusOr<CallArgs>> ClientAuthFilter::GetCallCredsMetadata(
|
|
157
160
|
|
158
161
|
auto client_initial_metadata = std::move(call_args.client_initial_metadata);
|
159
162
|
return TrySeq(
|
160
|
-
creds->GetRequestMetadata(std::move(client_initial_metadata), &args_),
|
163
|
+
Seq(creds->GetRequestMetadata(std::move(client_initial_metadata), &args_),
|
164
|
+
[](absl::StatusOr<ClientMetadataHandle> new_metadata) mutable {
|
165
|
+
if (!new_metadata.ok()) {
|
166
|
+
return absl::StatusOr<ClientMetadataHandle>(
|
167
|
+
MaybeRewriteIllegalStatusCode(new_metadata.status(),
|
168
|
+
"call credentials"));
|
169
|
+
}
|
170
|
+
return new_metadata;
|
171
|
+
}),
|
161
172
|
[call_args =
|
162
173
|
std::move(call_args)](ClientMetadataHandle new_metadata) mutable {
|
163
174
|
call_args.client_initial_metadata = std::move(new_metadata);
|
@@ -49,8 +49,6 @@
|
|
49
49
|
#include "src/core/lib/iomgr/error.h"
|
50
50
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
51
51
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
52
|
-
#include "src/core/lib/iomgr/pollset.h"
|
53
|
-
#include "src/core/lib/profiling/timers.h"
|
54
52
|
#include "src/core/lib/resource_quota/api.h"
|
55
53
|
#include "src/core/lib/resource_quota/memory_quota.h"
|
56
54
|
#include "src/core/lib/resource_quota/resource_quota.h"
|
@@ -386,8 +384,6 @@ static void flush_write_staging_buffer(secure_endpoint* ep, uint8_t** cur,
|
|
386
384
|
|
387
385
|
static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
|
388
386
|
grpc_closure* cb, void* arg, int max_frame_size) {
|
389
|
-
GPR_TIMER_SCOPE("secure_endpoint.endpoint_write", 0);
|
390
|
-
|
391
387
|
unsigned i;
|
392
388
|
tsi_result result = TSI_OK;
|
393
389
|
secure_endpoint* ep = reinterpret_cast<secure_endpoint*>(secure_ep);
|
@@ -63,7 +63,6 @@
|
|
63
63
|
#include "src/core/lib/iomgr/call_combiner.h"
|
64
64
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
65
65
|
#include "src/core/lib/iomgr/polling_entity.h"
|
66
|
-
#include "src/core/lib/profiling/timers.h"
|
67
66
|
#include "src/core/lib/resource_quota/arena.h"
|
68
67
|
#include "src/core/lib/slice/slice_buffer.h"
|
69
68
|
#include "src/core/lib/slice/slice_internal.h"
|
@@ -516,8 +515,6 @@ void Call::PublishToParent(Call* parent) {
|
|
516
515
|
|
517
516
|
grpc_error_handle FilterStackCall::Create(grpc_call_create_args* args,
|
518
517
|
grpc_call** out_call) {
|
519
|
-
GPR_TIMER_SCOPE("grpc_call_create", 0);
|
520
|
-
|
521
518
|
Channel* channel = args->channel.get();
|
522
519
|
|
523
520
|
auto add_init_error = [](grpc_error_handle* composite,
|
@@ -643,7 +640,6 @@ void FilterStackCall::ReleaseCall(void* call, grpc_error_handle /*error*/) {
|
|
643
640
|
}
|
644
641
|
|
645
642
|
void FilterStackCall::DestroyCall(void* call, grpc_error_handle /*error*/) {
|
646
|
-
GPR_TIMER_SCOPE("destroy_call", 0);
|
647
643
|
auto* c = static_cast<FilterStackCall*>(call);
|
648
644
|
c->recv_initial_metadata_.Clear();
|
649
645
|
c->recv_trailing_metadata_.Clear();
|
@@ -690,8 +686,6 @@ void Call::MaybeUnpublishFromParent() {
|
|
690
686
|
void FilterStackCall::ExternalUnref() {
|
691
687
|
if (GPR_LIKELY(!ext_ref_.Unref())) return;
|
692
688
|
|
693
|
-
GPR_TIMER_SCOPE("grpc_call_unref", 0);
|
694
|
-
|
695
689
|
ApplicationCallbackExecCtx callback_exec_ctx;
|
696
690
|
ExecCtx exec_ctx;
|
697
691
|
|
@@ -729,7 +723,6 @@ void FilterStackCall::ExecuteBatch(grpc_transport_stream_op_batch* batch,
|
|
729
723
|
// This is called via the call combiner to start sending a batch down
|
730
724
|
// the filter stack.
|
731
725
|
auto execute_batch_in_call_combiner = [](void* arg, grpc_error_handle) {
|
732
|
-
GPR_TIMER_SCOPE("execute_batch_in_call_combiner", 0);
|
733
726
|
grpc_transport_stream_op_batch* batch =
|
734
727
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
735
728
|
auto* call =
|
@@ -768,6 +761,7 @@ void FilterStackCall::CancelWithError(grpc_error_handle error) {
|
|
768
761
|
GRPC_ERROR_UNREF(error);
|
769
762
|
return;
|
770
763
|
}
|
764
|
+
gpr_atm_rel_store(&peer_string_, 0);
|
771
765
|
InternalRef("termination");
|
772
766
|
// Inform the call combiner of the cancellation, so that it can cancel
|
773
767
|
// any in-flight asynchronous actions that may be holding the call
|
@@ -928,7 +922,6 @@ void FilterStackCall::PublishAppMetadata(grpc_metadata_batch* b,
|
|
928
922
|
if (b->count() == 0) return;
|
929
923
|
if (!is_client() && is_trailing) return;
|
930
924
|
if (is_trailing && buffered_metadata_[1] == nullptr) return;
|
931
|
-
GPR_TIMER_SCOPE("publish_app_metadata", 0);
|
932
925
|
grpc_metadata_array* dest;
|
933
926
|
dest = buffered_metadata_[is_trailing];
|
934
927
|
if (dest->count + b->count() > dest->capacity) {
|
@@ -1229,7 +1222,6 @@ void FilterStackCall::BatchControl::ReceivingInitialMetadataReady(
|
|
1229
1222
|
call->RecvInitialFilter(md);
|
1230
1223
|
|
1231
1224
|
/* TODO(ctiller): this could be moved into recv_initial_filter now */
|
1232
|
-
GPR_TIMER_SCOPE("validate_filtered_metadata", 0);
|
1233
1225
|
ValidateFilteredMetadata();
|
1234
1226
|
|
1235
1227
|
absl::optional<Timestamp> deadline = md->get(GrpcTimeoutMetadata());
|
@@ -1300,8 +1292,6 @@ void FilterStackCall::BatchControl::FinishBatch(grpc_error_handle error) {
|
|
1300
1292
|
grpc_call_error FilterStackCall::StartBatch(const grpc_op* ops, size_t nops,
|
1301
1293
|
void* notify_tag,
|
1302
1294
|
bool is_notify_tag_closure) {
|
1303
|
-
GPR_TIMER_SCOPE("call_start_batch", 0);
|
1304
|
-
|
1305
1295
|
size_t i;
|
1306
1296
|
const grpc_op* op;
|
1307
1297
|
BatchControl* bctl;
|
@@ -56,6 +56,7 @@
|
|
56
56
|
#include "src/core/lib/surface/call.h"
|
57
57
|
#include "src/core/lib/surface/channel_init.h"
|
58
58
|
#include "src/core/lib/surface/channel_stack_type.h"
|
59
|
+
#include "src/core/lib/surface/init_internally.h"
|
59
60
|
#include "src/core/lib/transport/transport.h"
|
60
61
|
|
61
62
|
// IWYU pragma: no_include <type_traits>
|
@@ -92,7 +93,7 @@ Channel::Channel(bool is_client, std::string target,
|
|
92
93
|
// accommodate that, we call grpc_init() here and then call
|
93
94
|
// grpc_shutdown() when the channel is actually destroyed, thus
|
94
95
|
// ensuring that shutdown is deferred until that point.
|
95
|
-
|
96
|
+
InitInternally();
|
96
97
|
auto channelz_node = channelz_node_;
|
97
98
|
*channel_stack_->on_destroy = [channelz_node]() {
|
98
99
|
if (channelz_node != nullptr) {
|
@@ -100,7 +101,7 @@ Channel::Channel(bool is_client, std::string target,
|
|
100
101
|
channelz::ChannelTrace::Severity::Info,
|
101
102
|
grpc_slice_from_static_string("Channel destroyed"));
|
102
103
|
}
|
103
|
-
|
104
|
+
ShutdownInternally();
|
104
105
|
};
|
105
106
|
}
|
106
107
|
|