grpc 1.36.0 → 1.37.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 +65 -37
- data/include/grpc/grpc.h +15 -1
- data/include/grpc/impl/codegen/port_platform.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +327 -305
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
- data/src/core/ext/filters/client_channel/config_selector.h +8 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +9 -4
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +23 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +27 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +7 -22
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
- data/src/core/ext/filters/client_channel/resolver.cc +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +5 -9
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +18 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +295 -91
- data/src/core/ext/filters/client_channel/server_address.cc +3 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +69 -146
- data/src/core/ext/filters/client_channel/subchannel.h +63 -95
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +10 -8
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +495 -0
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +457 -170
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +39 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +5 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +350 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1348 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +6 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +25 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +15 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +44 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +78 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +281 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +13 -9
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +93 -0
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +383 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +10 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +13 -7
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +120 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +21 -20
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +130 -0
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
- data/src/core/ext/xds/xds_api.cc +1591 -279
- data/src/core/ext/xds/xds_api.h +279 -39
- data/src/core/ext/xds/xds_bootstrap.cc +21 -5
- data/src/core/ext/xds/xds_bootstrap.h +5 -1
- data/src/core/ext/xds/xds_client.cc +168 -23
- data/src/core/ext/xds/xds_client.h +26 -0
- data/src/core/ext/xds/xds_client_stats.h +2 -2
- data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
- data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
- data/src/core/ext/xds/xds_http_filters.cc +114 -0
- data/src/core/ext/xds/xds_http_filters.h +130 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +391 -126
- data/src/core/lib/channel/channel_stack.cc +12 -0
- data/src/core/lib/channel/channel_stack.h +7 -0
- data/src/core/lib/channel/channelz.cc +92 -4
- data/src/core/lib/channel/channelz.h +30 -1
- data/src/core/lib/channel/channelz_registry.cc +14 -0
- data/src/core/lib/channel/handshaker.cc +0 -39
- data/src/core/lib/channel/handshaker.h +0 -17
- data/src/core/lib/channel/status_util.cc +12 -2
- data/src/core/lib/channel/status_util.h +5 -0
- data/src/core/lib/gpr/sync_abseil.cc +3 -6
- data/src/core/lib/gpr/sync_windows.cc +2 -2
- data/src/core/lib/gprpp/atomic.h +3 -3
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/error.h +1 -1
- data/src/core/lib/iomgr/ev_apple.cc +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/iomgr/ev_posix.cc +3 -3
- data/src/core/lib/iomgr/exec_ctx.cc +6 -2
- data/src/core/lib/iomgr/resource_quota.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.cc +120 -0
- data/src/core/lib/iomgr/sockaddr_utils.h +25 -0
- data/src/core/lib/iomgr/tcp_posix.cc +1 -4
- data/src/core/lib/iomgr/tcp_uv.cc +2 -2
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/{security/authorization → matchers}/matchers.cc +8 -8
- data/src/core/lib/{security/authorization → matchers}/matchers.h +14 -12
- data/src/core/lib/security/security_connector/ssl_utils.cc +6 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -0
- data/src/core/lib/security/transport/security_handshaker.cc +32 -2
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +38 -19
- data/src/core/lib/surface/lame_client.h +4 -3
- data/src/core/lib/surface/server.cc +40 -33
- data/src/core/lib/surface/server.h +74 -15
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/metadata_batch.cc +27 -0
- data/src/core/lib/transport/metadata_batch.h +14 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
- data/src/core/tsi/fake_transport_security.cc +10 -1
- data/src/ruby/ext/grpc/extconf.rb +9 -1
- data/src/ruby/ext/grpc/rb_channel.c +10 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
- data/src/ruby/ext/grpc/rb_server.c +13 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +32 -0
- data/src/ruby/spec/channel_spec.rb +17 -6
- data/src/ruby/spec/client_auth_spec.rb +27 -1
- data/src/ruby/spec/errors_spec.rb +1 -1
- data/src/ruby/spec/generic/active_call_spec.rb +2 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +25 -0
- data/src/ruby/spec/server_spec.rb +22 -0
- data/third_party/boringssl-with-bazel/err_data.c +255 -255
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +21 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +0 -28
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +22 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +25 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +33 -19
- data/third_party/xxhash/xxhash.h +5443 -0
- metadata +93 -49
- data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
- data/src/core/lib/security/authorization/authorization_engine.h +0 -84
- data/src/core/lib/security/authorization/evaluate_args.cc +0 -148
- data/src/core/lib/security/authorization/evaluate_args.h +0 -59
- data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -99
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
- data/third_party/upb/upb/json_decode.c +0 -1443
- data/third_party/upb/upb/json_decode.h +0 -23
- data/third_party/upb/upb/json_encode.c +0 -713
- data/third_party/upb/upb/json_encode.h +0 -36
@@ -22,6 +22,7 @@
|
|
22
22
|
#include <list>
|
23
23
|
#include <vector>
|
24
24
|
|
25
|
+
#include "absl/status/statusor.h"
|
25
26
|
#include "absl/types/optional.h"
|
26
27
|
|
27
28
|
#include <grpc/grpc.h>
|
@@ -31,6 +32,7 @@
|
|
31
32
|
#include "src/core/lib/channel/channelz.h"
|
32
33
|
#include "src/core/lib/debug/trace.h"
|
33
34
|
#include "src/core/lib/gprpp/atomic.h"
|
35
|
+
#include "src/core/lib/iomgr/resolve_address.h"
|
34
36
|
#include "src/core/lib/surface/completion_queue.h"
|
35
37
|
#include "src/core/lib/transport/transport.h"
|
36
38
|
|
@@ -49,21 +51,23 @@ class Server : public InternallyRefCounted<Server> {
|
|
49
51
|
// An object to represent the most relevant characteristics of a
|
50
52
|
// newly-allocated call object when using an AllocatingRequestMatcherBatch.
|
51
53
|
struct BatchCallAllocation {
|
52
|
-
|
54
|
+
void* tag;
|
53
55
|
grpc_call** call;
|
54
56
|
grpc_metadata_array* initial_metadata;
|
55
57
|
grpc_call_details* details;
|
58
|
+
grpc_completion_queue* cq;
|
56
59
|
};
|
57
60
|
|
58
61
|
// An object to represent the most relevant characteristics of a
|
59
62
|
// newly-allocated call object when using an
|
60
63
|
// AllocatingRequestMatcherRegistered.
|
61
64
|
struct RegisteredCallAllocation {
|
62
|
-
|
65
|
+
void* tag;
|
63
66
|
grpc_call** call;
|
64
67
|
grpc_metadata_array* initial_metadata;
|
65
68
|
gpr_timespec* deadline;
|
66
69
|
grpc_byte_buffer** optional_payload;
|
70
|
+
grpc_completion_queue* cq;
|
67
71
|
};
|
68
72
|
|
69
73
|
/// Interface for listeners.
|
@@ -90,7 +94,7 @@ class Server : public InternallyRefCounted<Server> {
|
|
90
94
|
explicit Server(const grpc_channel_args* args);
|
91
95
|
~Server() override;
|
92
96
|
|
93
|
-
void Orphan() override;
|
97
|
+
void Orphan() ABSL_LOCKS_EXCLUDED(mu_global_) override;
|
94
98
|
|
95
99
|
const grpc_channel_args* channel_args() const { return channel_args_; }
|
96
100
|
grpc_resource_user* default_resource_user() const {
|
@@ -112,7 +116,7 @@ class Server : public InternallyRefCounted<Server> {
|
|
112
116
|
config_fetcher_ = std::move(config_fetcher);
|
113
117
|
}
|
114
118
|
|
115
|
-
bool HasOpenConnections();
|
119
|
+
bool HasOpenConnections() ABSL_LOCKS_EXCLUDED(mu_global_);
|
116
120
|
|
117
121
|
// Adds a listener to the server. When the server starts, it will call
|
118
122
|
// the listener's Start() method, and when it shuts down, it will orphan
|
@@ -120,7 +124,7 @@ class Server : public InternallyRefCounted<Server> {
|
|
120
124
|
void AddListener(OrphanablePtr<ListenerInterface> listener);
|
121
125
|
|
122
126
|
// Starts listening for connections.
|
123
|
-
void Start();
|
127
|
+
void Start() ABSL_LOCKS_EXCLUDED(mu_global_);
|
124
128
|
|
125
129
|
// Sets up a transport. Creates a channel stack and binds the transport to
|
126
130
|
// the server. Called from the listener when a new connection is accepted.
|
@@ -158,9 +162,10 @@ class Server : public InternallyRefCounted<Server> {
|
|
158
162
|
grpc_completion_queue* cq_bound_to_call,
|
159
163
|
grpc_completion_queue* cq_for_notification, void* tag_new);
|
160
164
|
|
161
|
-
void ShutdownAndNotify(grpc_completion_queue* cq, void* tag)
|
165
|
+
void ShutdownAndNotify(grpc_completion_queue* cq, void* tag)
|
166
|
+
ABSL_LOCKS_EXCLUDED(mu_global_, mu_call_);
|
162
167
|
|
163
|
-
void CancelAllCalls();
|
168
|
+
void CancelAllCalls() ABSL_LOCKS_EXCLUDED(mu_global_);
|
164
169
|
|
165
170
|
private:
|
166
171
|
struct RequestedCall;
|
@@ -207,7 +212,7 @@ class Server : public InternallyRefCounted<Server> {
|
|
207
212
|
static void AcceptStream(void* arg, grpc_transport* /*transport*/,
|
208
213
|
const void* transport_server_data);
|
209
214
|
|
210
|
-
void Destroy();
|
215
|
+
void Destroy() ABSL_EXCLUSIVE_LOCKS_REQUIRED(server_->mu_global_);
|
211
216
|
|
212
217
|
static void FinishDestroy(void* arg, grpc_error* error);
|
213
218
|
|
@@ -343,9 +348,11 @@ class Server : public InternallyRefCounted<Server> {
|
|
343
348
|
void FailCall(size_t cq_idx, RequestedCall* rc, grpc_error* error);
|
344
349
|
grpc_call_error QueueRequestedCall(size_t cq_idx, RequestedCall* rc);
|
345
350
|
|
346
|
-
void MaybeFinishShutdown()
|
351
|
+
void MaybeFinishShutdown() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_)
|
352
|
+
ABSL_LOCKS_EXCLUDED(mu_call_);
|
347
353
|
|
348
|
-
void KillPendingWorkLocked(grpc_error* error)
|
354
|
+
void KillPendingWorkLocked(grpc_error* error)
|
355
|
+
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_call_);
|
349
356
|
|
350
357
|
static grpc_call_error ValidateServerRequest(
|
351
358
|
grpc_completion_queue* cq_for_notification, void* tag,
|
@@ -356,6 +363,39 @@ class Server : public InternallyRefCounted<Server> {
|
|
356
363
|
|
357
364
|
std::vector<grpc_channel*> GetChannelsLocked() const;
|
358
365
|
|
366
|
+
// Take a shutdown ref for a request (increment by 2) and return if shutdown
|
367
|
+
// has already been called.
|
368
|
+
bool ShutdownRefOnRequest() {
|
369
|
+
int old_value = shutdown_refs_.FetchAdd(2, MemoryOrder::ACQ_REL);
|
370
|
+
return (old_value & 1) != 0;
|
371
|
+
}
|
372
|
+
|
373
|
+
// Decrement the shutdown ref counter by either 1 (for shutdown call) or 2
|
374
|
+
// (for in-flight request) and possibly call MaybeFinishShutdown if
|
375
|
+
// appropriate.
|
376
|
+
void ShutdownUnrefOnRequest() ABSL_LOCKS_EXCLUDED(mu_global_) {
|
377
|
+
if (shutdown_refs_.FetchSub(2, MemoryOrder::ACQ_REL) == 2) {
|
378
|
+
MutexLock lock(&mu_global_);
|
379
|
+
MaybeFinishShutdown();
|
380
|
+
}
|
381
|
+
}
|
382
|
+
void ShutdownUnrefOnShutdownCall() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_) {
|
383
|
+
if (shutdown_refs_.FetchSub(1, MemoryOrder::ACQ_REL) == 1) {
|
384
|
+
MaybeFinishShutdown();
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
bool ShutdownCalled() const {
|
389
|
+
return (shutdown_refs_.Load(MemoryOrder::ACQUIRE) & 1) == 0;
|
390
|
+
}
|
391
|
+
|
392
|
+
// Returns whether there are no more shutdown refs, which means that shutdown
|
393
|
+
// has been called and all accepted requests have been published if using an
|
394
|
+
// AllocatingRequestMatcher.
|
395
|
+
bool ShutdownReady() const {
|
396
|
+
return shutdown_refs_.Load(MemoryOrder::ACQUIRE) == 0;
|
397
|
+
}
|
398
|
+
|
359
399
|
grpc_channel_args* const channel_args_;
|
360
400
|
grpc_resource_user* default_resource_user_ = nullptr;
|
361
401
|
RefCountedPtr<channelz::ServerNode> channelz_node_;
|
@@ -385,9 +425,15 @@ class Server : public InternallyRefCounted<Server> {
|
|
385
425
|
// Request matcher for unregistered methods.
|
386
426
|
std::unique_ptr<RequestMatcherInterface> unregistered_request_matcher_;
|
387
427
|
|
388
|
-
|
389
|
-
|
390
|
-
|
428
|
+
// The shutdown refs counter tracks whether or not shutdown has been called
|
429
|
+
// and whether there are any AllocatingRequestMatcher requests that have been
|
430
|
+
// accepted but not yet started (+2 on each one). If shutdown has been called,
|
431
|
+
// the lowest bit will be 0 (defaults to 1) and the counter will be even. The
|
432
|
+
// server should not notify on shutdown until the counter is 0 (shutdown is
|
433
|
+
// called and there are no requests that are accepted but not started).
|
434
|
+
Atomic<int> shutdown_refs_{1};
|
435
|
+
bool shutdown_published_ ABSL_GUARDED_BY(mu_global_) = false;
|
436
|
+
std::vector<ShutdownTag> shutdown_tags_ ABSL_GUARDED_BY(mu_global_);
|
391
437
|
|
392
438
|
std::list<ChannelData*> channels_;
|
393
439
|
|
@@ -412,11 +458,24 @@ struct grpc_server {
|
|
412
458
|
// approaches here.
|
413
459
|
struct grpc_server_config_fetcher {
|
414
460
|
public:
|
461
|
+
class ConnectionManager : public grpc_core::RefCounted<ConnectionManager> {
|
462
|
+
public:
|
463
|
+
// Ownership of \a args is transfered.
|
464
|
+
virtual absl::StatusOr<grpc_channel_args*> UpdateChannelArgsForConnection(
|
465
|
+
grpc_channel_args* args, grpc_endpoint* tcp) = 0;
|
466
|
+
};
|
467
|
+
|
415
468
|
class WatcherInterface {
|
416
469
|
public:
|
417
470
|
virtual ~WatcherInterface() = default;
|
418
|
-
//
|
419
|
-
|
471
|
+
// UpdateConnectionManager() is invoked by the config fetcher when a new
|
472
|
+
// config is available. Implementations should update the connection manager
|
473
|
+
// and start serving if not already serving.
|
474
|
+
virtual void UpdateConnectionManager(
|
475
|
+
grpc_core::RefCountedPtr<ConnectionManager> manager) = 0;
|
476
|
+
// Implementations should stop serving when this is called. Serving should
|
477
|
+
// only resume when UpdateConfig() is invoked.
|
478
|
+
virtual void StopServing() = 0;
|
420
479
|
};
|
421
480
|
|
422
481
|
virtual ~grpc_server_config_fetcher() = default;
|
@@ -23,6 +23,9 @@
|
|
23
23
|
#include <stdbool.h>
|
24
24
|
#include <string.h>
|
25
25
|
|
26
|
+
#include "absl/container/inlined_vector.h"
|
27
|
+
#include "absl/strings/str_join.h"
|
28
|
+
|
26
29
|
#include <grpc/support/alloc.h>
|
27
30
|
#include <grpc/support/log.h>
|
28
31
|
|
@@ -296,6 +299,30 @@ void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
|
|
296
299
|
GRPC_MDELEM_UNREF(old_mdelem);
|
297
300
|
}
|
298
301
|
|
302
|
+
absl::optional<absl::string_view> grpc_metadata_batch_get_value(
|
303
|
+
grpc_metadata_batch* batch, absl::string_view target_key,
|
304
|
+
std::string* concatenated_value) {
|
305
|
+
// Find all values for the specified key.
|
306
|
+
GPR_DEBUG_ASSERT(batch != nullptr);
|
307
|
+
absl::InlinedVector<absl::string_view, 1> values;
|
308
|
+
for (grpc_linked_mdelem* md = batch->list.head; md != nullptr;
|
309
|
+
md = md->next) {
|
310
|
+
absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md->md));
|
311
|
+
absl::string_view value =
|
312
|
+
grpc_core::StringViewFromSlice(GRPC_MDVALUE(md->md));
|
313
|
+
if (target_key == key) values.push_back(value);
|
314
|
+
}
|
315
|
+
// If none found, no match.
|
316
|
+
if (values.empty()) return absl::nullopt;
|
317
|
+
// If exactly one found, return it as-is.
|
318
|
+
if (values.size() == 1) return values.front();
|
319
|
+
// If more than one found, concatenate the values, using
|
320
|
+
// *concatenated_values as a temporary holding place for the
|
321
|
+
// concatenated string.
|
322
|
+
*concatenated_value = absl::StrJoin(values, ",");
|
323
|
+
return *concatenated_value;
|
324
|
+
}
|
325
|
+
|
299
326
|
grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
|
300
327
|
grpc_linked_mdelem* storage,
|
301
328
|
grpc_mdelem new_mdelem) {
|
@@ -23,9 +23,12 @@
|
|
23
23
|
|
24
24
|
#include <stdbool.h>
|
25
25
|
|
26
|
+
#include "absl/types/optional.h"
|
27
|
+
|
26
28
|
#include <grpc/grpc.h>
|
27
29
|
#include <grpc/slice.h>
|
28
30
|
#include <grpc/support/time.h>
|
31
|
+
|
29
32
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
30
33
|
#include "src/core/lib/transport/metadata.h"
|
31
34
|
#include "src/core/lib/transport/static_metadata.h"
|
@@ -78,6 +81,17 @@ grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
|
|
78
81
|
void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
|
79
82
|
const grpc_slice& value);
|
80
83
|
|
84
|
+
/** Returns metadata value(s) for the specified key.
|
85
|
+
If the key is not present in the batch, returns absl::nullopt.
|
86
|
+
If the key is present exactly once in the batch, returns a string_view of
|
87
|
+
that value.
|
88
|
+
If the key is present more than once in the batch, constructs a
|
89
|
+
comma-concatenated string of all values in concatenated_value and returns a
|
90
|
+
string_view of that string. */
|
91
|
+
absl::optional<absl::string_view> grpc_metadata_batch_get_value(
|
92
|
+
grpc_metadata_batch* batch, absl::string_view target_key,
|
93
|
+
std::string* concatenated_value);
|
94
|
+
|
81
95
|
/** Add \a storage to the beginning of \a batch. storage->md is
|
82
96
|
assumed to be valid.
|
83
97
|
\a storage is owned by the caller and must survive for the
|
@@ -60,6 +60,10 @@ void grpc_client_authority_filter_init(void);
|
|
60
60
|
void grpc_client_authority_filter_shutdown(void);
|
61
61
|
void grpc_workaround_cronet_compression_filter_init(void);
|
62
62
|
void grpc_workaround_cronet_compression_filter_shutdown(void);
|
63
|
+
namespace grpc_core {
|
64
|
+
void FaultInjectionFilterInit(void);
|
65
|
+
void FaultInjectionFilterShutdown(void);
|
66
|
+
} // namespace grpc_core
|
63
67
|
|
64
68
|
#ifndef GRPC_NO_XDS
|
65
69
|
namespace grpc_core {
|
@@ -123,6 +127,8 @@ void grpc_register_built_in_plugins(void) {
|
|
123
127
|
grpc_max_age_filter_shutdown);
|
124
128
|
grpc_register_plugin(grpc_message_size_filter_init,
|
125
129
|
grpc_message_size_filter_shutdown);
|
130
|
+
grpc_register_plugin(grpc_core::FaultInjectionFilterInit,
|
131
|
+
grpc_core::FaultInjectionFilterShutdown);
|
126
132
|
grpc_register_plugin(grpc_service_config_channel_arg_filter_init,
|
127
133
|
grpc_service_config_channel_arg_filter_shutdown);
|
128
134
|
grpc_register_plugin(grpc_client_authority_filter_init,
|
@@ -117,10 +117,7 @@ static void handshaker_client_send_buffer_destroy(
|
|
117
117
|
|
118
118
|
static bool is_handshake_finished_properly(grpc_gcp_HandshakerResp* resp) {
|
119
119
|
GPR_ASSERT(resp != nullptr);
|
120
|
-
|
121
|
-
return true;
|
122
|
-
}
|
123
|
-
return false;
|
120
|
+
return grpc_gcp_HandshakerResp_result(resp) != nullptr;
|
124
121
|
}
|
125
122
|
|
126
123
|
static void alts_grpc_handshaker_client_unref(
|
@@ -41,7 +41,7 @@ const size_t kTsiAltsNumOfPeerProperties = 5;
|
|
41
41
|
// Frame size negotiation extends send frame size range to
|
42
42
|
// [kTsiAltsMinFrameSize, kTsiAltsMaxFrameSize].
|
43
43
|
const size_t kTsiAltsMinFrameSize = 16 * 1024;
|
44
|
-
const size_t kTsiAltsMaxFrameSize =
|
44
|
+
const size_t kTsiAltsMaxFrameSize = 1024 * 1024;
|
45
45
|
|
46
46
|
typedef struct alts_tsi_handshaker alts_tsi_handshaker;
|
47
47
|
|
@@ -214,9 +214,7 @@ bool grpc_gcp_rpc_protocol_versions_check(
|
|
214
214
|
? &local_versions->min_rpc_version
|
215
215
|
: &peer_versions->min_rpc_version;
|
216
216
|
bool result = grpc_core::internal::grpc_gcp_rpc_protocol_version_compare(
|
217
|
-
max_common_version, min_common_version) >= 0
|
218
|
-
? true
|
219
|
-
: false;
|
217
|
+
max_common_version, min_common_version) >= 0;
|
220
218
|
if (result && highest_common_version != nullptr) {
|
221
219
|
memcpy(highest_common_version, max_common_version,
|
222
220
|
sizeof(grpc_gcp_rpc_protocol_versions_version));
|
@@ -474,12 +474,21 @@ static void fake_zero_copy_grpc_protector_destroy(
|
|
474
474
|
gpr_free(impl);
|
475
475
|
}
|
476
476
|
|
477
|
+
static tsi_result fake_zero_copy_grpc_protector_max_frame_size(
|
478
|
+
tsi_zero_copy_grpc_protector* self, size_t* max_frame_size) {
|
479
|
+
if (self == nullptr || max_frame_size == nullptr) return TSI_INVALID_ARGUMENT;
|
480
|
+
tsi_fake_zero_copy_grpc_protector* impl =
|
481
|
+
reinterpret_cast<tsi_fake_zero_copy_grpc_protector*>(self);
|
482
|
+
*max_frame_size = impl->max_frame_size;
|
483
|
+
return TSI_OK;
|
484
|
+
}
|
485
|
+
|
477
486
|
static const tsi_zero_copy_grpc_protector_vtable
|
478
487
|
zero_copy_grpc_protector_vtable = {
|
479
488
|
fake_zero_copy_grpc_protector_protect,
|
480
489
|
fake_zero_copy_grpc_protector_unprotect,
|
481
490
|
fake_zero_copy_grpc_protector_destroy,
|
482
|
-
|
491
|
+
fake_zero_copy_grpc_protector_max_frame_size,
|
483
492
|
};
|
484
493
|
|
485
494
|
/* --- tsi_handshaker_result methods implementation. ---*/
|
@@ -45,8 +45,16 @@ if RUBY_PLATFORM =~ /darwin/
|
|
45
45
|
ENV['EMBED_OPENSSL'] = 'true'
|
46
46
|
ENV['EMBED_ZLIB'] = 'true'
|
47
47
|
ENV['EMBED_CARES'] = 'true'
|
48
|
+
|
48
49
|
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
|
49
|
-
|
50
|
+
if RUBY_PLATFORM =~ /darwin/
|
51
|
+
if RUBY_PLATFORM =~ /arm64/
|
52
|
+
ENV['ARCH_FLAGS'] = '-arch arm64'
|
53
|
+
else
|
54
|
+
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
50
58
|
ENV['CPPFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
|
51
59
|
|
52
60
|
output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include "rb_completion_queue.h"
|
35
35
|
#include "rb_grpc.h"
|
36
36
|
#include "rb_server.h"
|
37
|
+
#include "rb_xds_channel_credentials.h"
|
37
38
|
|
38
39
|
/* id_channel is the name of the hidden ivar that preserves a reference to the
|
39
40
|
* channel on a call, so that calls are not GCed before their channel. */
|
@@ -242,7 +243,15 @@ static VALUE grpc_rb_channel_init(int argc, VALUE* argv, VALUE self) {
|
|
242
243
|
ch = grpc_insecure_channel_create(target_chars, &args, NULL);
|
243
244
|
} else {
|
244
245
|
wrapper->credentials = credentials;
|
245
|
-
|
246
|
+
if (grpc_rb_is_channel_credentials(credentials)) {
|
247
|
+
creds = grpc_rb_get_wrapped_channel_credentials(credentials);
|
248
|
+
} else if (grpc_rb_is_xds_channel_credentials(credentials)) {
|
249
|
+
creds = grpc_rb_get_wrapped_xds_channel_credentials(credentials);
|
250
|
+
} else {
|
251
|
+
rb_raise(rb_eTypeError,
|
252
|
+
"bad creds, want ChannelCredentials or XdsChannelCredentials");
|
253
|
+
return Qnil;
|
254
|
+
}
|
246
255
|
ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
|
247
256
|
}
|
248
257
|
|
@@ -180,7 +180,11 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE* argv,
|
|
180
180
|
NULL, NULL);
|
181
181
|
}
|
182
182
|
if (creds == NULL) {
|
183
|
-
rb_raise(rb_eRuntimeError,
|
183
|
+
rb_raise(rb_eRuntimeError,
|
184
|
+
"the call to grpc_ssl_credentials_create() failed, could not "
|
185
|
+
"create a credentials, see "
|
186
|
+
"https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for "
|
187
|
+
"debugging tips");
|
184
188
|
return Qnil;
|
185
189
|
}
|
186
190
|
wrapper->wrapped = creds;
|
@@ -270,7 +274,13 @@ void Init_grpc_channel_credentials() {
|
|
270
274
|
/* Gets the wrapped grpc_channel_credentials from the ruby wrapper */
|
271
275
|
grpc_channel_credentials* grpc_rb_get_wrapped_channel_credentials(VALUE v) {
|
272
276
|
grpc_rb_channel_credentials* wrapper = NULL;
|
277
|
+
Check_TypedStruct(v, &grpc_rb_channel_credentials_data_type);
|
273
278
|
TypedData_Get_Struct(v, grpc_rb_channel_credentials,
|
274
279
|
&grpc_rb_channel_credentials_data_type, wrapper);
|
275
280
|
return wrapper->wrapped;
|
276
281
|
}
|
282
|
+
|
283
|
+
/* Check if v is kind of ChannelCredentials */
|
284
|
+
bool grpc_rb_is_channel_credentials(VALUE v) {
|
285
|
+
return rb_typeddata_is_kind_of(v, &grpc_rb_channel_credentials_data_type);
|
286
|
+
}
|
@@ -20,6 +20,7 @@
|
|
20
20
|
#define GRPC_RB_CREDENTIALS_H_
|
21
21
|
|
22
22
|
#include <ruby/ruby.h>
|
23
|
+
#include <stdbool.h>
|
23
24
|
|
24
25
|
#include <grpc/grpc_security.h>
|
25
26
|
|
@@ -29,4 +30,7 @@ void Init_grpc_channel_credentials();
|
|
29
30
|
/* Gets the wrapped credentials from the ruby wrapper */
|
30
31
|
grpc_channel_credentials* grpc_rb_get_wrapped_channel_credentials(VALUE v);
|
31
32
|
|
33
|
+
/* Check if v is kind of ChannelCredentials */
|
34
|
+
bool grpc_rb_is_channel_credentials(VALUE v);
|
35
|
+
|
32
36
|
#endif /* GRPC_RB_CREDENTIALS_H_ */
|
@@ -142,7 +142,7 @@ grpc_compression_level grpc_rb_compression_options_level_name_to_value_internal(
|
|
142
142
|
"Unrecognized compression level name."
|
143
143
|
"Valid compression level names are none, low, medium, and high.");
|
144
144
|
|
145
|
-
/*
|
145
|
+
/* Phony return statement. */
|
146
146
|
return GRPC_COMPRESS_LEVEL_NONE;
|
147
147
|
}
|
148
148
|
|