grpc 1.23.1 → 1.24.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 +757 -477
- data/include/grpc/grpc.h +3 -1
- data/include/grpc/grpc_security.h +20 -4
- data/include/grpc/impl/codegen/grpc_types.h +6 -5
- data/include/grpc/impl/codegen/port_platform.h +25 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +78 -0
- data/src/core/ext/filters/client_channel/backend_metric.h +36 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +16 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +325 -267
- data/src/core/ext/filters/client_channel/client_channel_factory.h +0 -4
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +23 -32
- data/src/core/ext/filters/client_channel/http_proxy.cc +7 -3
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +58 -34
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +46 -50
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +35 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +130 -215
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +34 -21
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1120 -802
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +8 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +33 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +151 -40
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +184 -26
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +389 -245
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +98 -60
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -1
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +89 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +3 -8
- data/src/core/ext/filters/client_channel/server_address.cc +1 -3
- data/src/core/ext/filters/client_channel/server_address.h +1 -1
- data/src/core/ext/filters/client_channel/subchannel.h +2 -1
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +207 -29
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -8
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +10 -7
- data/src/core/ext/filters/http/server/http_server_filter.cc +52 -26
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -20
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +24 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +37 -24
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +237 -191
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +29 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +19 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +13 -4
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +0 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +99 -71
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +222 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +818 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +314 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1142 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +158 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +69 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +49 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +240 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +110 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +324 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +235 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +661 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +84 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +274 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +175 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +572 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +150 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +596 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +80 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +95 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +308 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +128 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +392 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +236 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +324 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +23 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +50 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +52 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +130 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +39 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +87 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +39 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +85 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +17 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +18 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/http.upb.c +66 -0
- data/src/core/ext/upb-generated/google/api/http.upb.h +190 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +485 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1690 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +22 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +50 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +79 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +215 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +106 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +238 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +33 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +74 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +49 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +126 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +209 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +681 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +42 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +109 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +36 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +84 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +133 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +359 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +58 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +144 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +443 -0
- data/src/core/ext/upb-generated/validate/validate.upb.h +2037 -0
- data/src/core/lib/channel/channel_args.cc +21 -0
- data/src/core/lib/channel/channel_args.h +16 -2
- data/src/core/lib/channel/channel_stack.h +2 -1
- data/src/core/lib/channel/channelz.cc +54 -56
- data/src/core/lib/channel/channelz.h +29 -12
- data/src/core/lib/compression/compression.cc +2 -1
- data/src/core/lib/compression/compression_internal.h +8 -0
- data/src/core/lib/gpr/log_linux.cc +2 -2
- data/src/core/lib/gpr/log_posix.cc +2 -2
- data/src/core/lib/gpr/time_precise.cc +123 -36
- data/src/core/lib/gpr/time_precise.h +37 -0
- data/src/core/lib/gprpp/abstract.h +10 -0
- data/src/core/lib/gprpp/atomic.h +4 -0
- data/src/core/lib/gprpp/inlined_vector.h +20 -4
- data/src/core/lib/gprpp/map.h +109 -6
- data/src/core/lib/gprpp/memory.h +6 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +29 -54
- data/src/core/lib/iomgr/exec_ctx.cc +27 -17
- data/src/core/lib/iomgr/exec_ctx.h +3 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -3
- data/src/core/lib/iomgr/tcp_posix.cc +16 -25
- data/src/core/lib/iomgr/tcp_server_custom.cc +1 -1
- data/src/core/lib/iomgr/timer_manager.cc +8 -1
- data/src/core/lib/iomgr/timer_manager.h +2 -0
- data/src/core/lib/security/credentials/credentials.h +8 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +3 -3
- data/src/core/lib/security/security_connector/ssl_utils.cc +1 -12
- data/src/core/lib/security/security_connector/ssl_utils.h +10 -6
- data/src/core/lib/security/security_connector/ssl_utils_config.cc +32 -0
- data/src/core/lib/security/security_connector/ssl_utils_config.h +30 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +161 -49
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +34 -1
- data/src/core/lib/slice/slice_intern.cc +17 -9
- data/src/core/lib/slice/slice_internal.h +34 -7
- data/src/core/lib/slice/slice_utils.h +7 -3
- data/src/core/lib/surface/call.cc +97 -57
- data/src/core/lib/surface/channel.cc +2 -2
- data/src/core/lib/surface/completion_queue.cc +10 -16
- data/src/core/lib/surface/init.cc +3 -0
- data/src/core/lib/surface/server.cc +11 -14
- data/src/core/lib/surface/validate_metadata.cc +4 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +4 -4
- data/src/core/lib/transport/metadata_batch.cc +72 -16
- data/src/core/lib/transport/metadata_batch.h +38 -0
- data/src/core/lib/transport/static_metadata.cc +814 -1023
- data/src/core/lib/transport/static_metadata.h +271 -213
- data/src/core/lib/transport/transport.h +12 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +104 -76
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -16
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +10 -6
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +74 -48
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +34 -26
- data/src/core/tsi/ssl_transport_security.cc +14 -6
- data/src/core/tsi/ssl_transport_security.h +4 -0
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +6 -0
- data/src/ruby/ext/grpc/extconf.rb +5 -0
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
- data/src/ruby/ext/grpc/rb_grpc.c +1 -42
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc.rb +2 -0
- data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
- data/src/ruby/lib/grpc/errors.rb +4 -7
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -4
- data/src/ruby/lib/grpc/structs.rb +15 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/errors_spec.rb +1 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +34 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +53 -29
- data/third_party/upb/upb/decode.c +604 -0
- data/third_party/upb/upb/decode.h +21 -0
- data/third_party/upb/upb/encode.c +378 -0
- data/third_party/upb/upb/encode.h +21 -0
- data/third_party/upb/upb/generated_util.h +105 -0
- data/third_party/upb/upb/msg.c +111 -0
- data/third_party/upb/upb/msg.h +69 -0
- data/third_party/upb/upb/port.c +27 -0
- data/third_party/upb/upb/port_def.inc +152 -0
- data/third_party/upb/upb/port_undef.inc +21 -0
- data/third_party/upb/upb/table.c +911 -0
- data/third_party/upb/upb/table.int.h +507 -0
- data/third_party/upb/upb/upb.c +261 -0
- data/third_party/upb/upb/upb.h +364 -0
- metadata +134 -55
- data/src/core/ext/filters/client_channel/health/health.pb.c +0 -23
- data/src/core/ext/filters/client_channel/health/health.pb.h +0 -73
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +0 -89
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -164
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +0 -520
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +0 -323
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +0 -145
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +0 -149
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -47
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +0 -63
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -122
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +0 -254
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -49
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +0 -78
- data/third_party/nanopb/pb.h +0 -579
- data/third_party/nanopb/pb_common.c +0 -97
- data/third_party/nanopb/pb_common.h +0 -42
- data/third_party/nanopb/pb_decode.c +0 -1347
- data/third_party/nanopb/pb_decode.h +0 -149
- data/third_party/nanopb/pb_encode.c +0 -696
- data/third_party/nanopb/pb_encode.h +0 -154
@@ -174,6 +174,17 @@ struct grpc_slice_refcount {
|
|
174
174
|
|
175
175
|
namespace grpc_core {
|
176
176
|
|
177
|
+
struct StaticSliceRefcount {
|
178
|
+
static grpc_slice_refcount kStaticSubRefcount;
|
179
|
+
|
180
|
+
StaticSliceRefcount(uint32_t index)
|
181
|
+
: base(&kStaticSubRefcount, grpc_slice_refcount::Type::STATIC),
|
182
|
+
index(index) {}
|
183
|
+
|
184
|
+
grpc_slice_refcount base;
|
185
|
+
const uint32_t index;
|
186
|
+
};
|
187
|
+
|
177
188
|
extern grpc_slice_refcount kNoopRefcount;
|
178
189
|
|
179
190
|
struct InternedSliceRefcount {
|
@@ -203,23 +214,39 @@ struct InternedSliceRefcount {
|
|
203
214
|
|
204
215
|
} // namespace grpc_core
|
205
216
|
|
217
|
+
inline size_t grpc_refcounted_slice_length(const grpc_slice& slice) {
|
218
|
+
GPR_DEBUG_ASSERT(slice.refcount != nullptr);
|
219
|
+
return slice.data.refcounted.length;
|
220
|
+
}
|
221
|
+
|
222
|
+
inline const uint8_t* grpc_refcounted_slice_data(const grpc_slice& slice) {
|
223
|
+
GPR_DEBUG_ASSERT(slice.refcount != nullptr);
|
224
|
+
return slice.data.refcounted.bytes;
|
225
|
+
}
|
226
|
+
|
206
227
|
inline int grpc_slice_refcount::Eq(const grpc_slice& a, const grpc_slice& b) {
|
228
|
+
GPR_DEBUG_ASSERT(a.refcount != nullptr);
|
229
|
+
GPR_DEBUG_ASSERT(a.refcount == this);
|
207
230
|
switch (ref_type_) {
|
208
231
|
case Type::STATIC:
|
209
|
-
|
232
|
+
GPR_DEBUG_ASSERT(
|
233
|
+
(GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b)) ==
|
234
|
+
(a.refcount == b.refcount));
|
210
235
|
case Type::INTERNED:
|
211
236
|
return a.refcount == b.refcount;
|
212
237
|
case Type::NOP:
|
213
238
|
case Type::REGULAR:
|
214
239
|
break;
|
215
240
|
}
|
216
|
-
if (
|
217
|
-
if (
|
218
|
-
return 0 == memcmp(
|
219
|
-
|
241
|
+
if (grpc_refcounted_slice_length(a) != GRPC_SLICE_LENGTH(b)) return false;
|
242
|
+
if (grpc_refcounted_slice_length(a) == 0) return true;
|
243
|
+
return 0 == memcmp(grpc_refcounted_slice_data(a), GRPC_SLICE_START_PTR(b),
|
244
|
+
grpc_refcounted_slice_length(a));
|
220
245
|
}
|
221
246
|
|
222
247
|
inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) {
|
248
|
+
GPR_DEBUG_ASSERT(slice.refcount != nullptr);
|
249
|
+
GPR_DEBUG_ASSERT(slice.refcount == this);
|
223
250
|
switch (ref_type_) {
|
224
251
|
case Type::STATIC:
|
225
252
|
return ::grpc_static_metadata_hash_values[GRPC_STATIC_METADATA_INDEX(
|
@@ -231,8 +258,8 @@ inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) {
|
|
231
258
|
case Type::REGULAR:
|
232
259
|
break;
|
233
260
|
}
|
234
|
-
return gpr_murmur_hash3(
|
235
|
-
g_hash_seed);
|
261
|
+
return gpr_murmur_hash3(grpc_refcounted_slice_data(slice),
|
262
|
+
grpc_refcounted_slice_length(slice), g_hash_seed);
|
236
263
|
}
|
237
264
|
|
238
265
|
inline const grpc_slice& grpc_slice_ref_internal(const grpc_slice& slice) {
|
@@ -108,7 +108,7 @@ struct ManagedMemorySlice : public grpc_slice {
|
|
108
108
|
return !grpc_slice_differs_refcounted(other, *this);
|
109
109
|
}
|
110
110
|
bool Equals(const char* buf, const size_t len) const {
|
111
|
-
return data.refcounted.length == len &&
|
111
|
+
return data.refcounted.length == len && buf != nullptr &&
|
112
112
|
memcmp(buf, data.refcounted.bytes, len) == 0;
|
113
113
|
}
|
114
114
|
};
|
@@ -153,10 +153,14 @@ struct ExternallyManagedSlice : public UnmanagedMemorySlice {
|
|
153
153
|
};
|
154
154
|
|
155
155
|
struct StaticMetadataSlice : public ManagedMemorySlice {
|
156
|
-
StaticMetadataSlice(grpc_slice_refcount* ref, size_t length,
|
156
|
+
StaticMetadataSlice(grpc_slice_refcount* ref, size_t length,
|
157
|
+
const uint8_t* bytes) {
|
157
158
|
refcount = ref;
|
158
159
|
data.refcounted.length = length;
|
159
|
-
|
160
|
+
// NB: grpc_slice may or may not point to a static slice, but we are
|
161
|
+
// definitely pointing to static data here. Since we are not changing
|
162
|
+
// the underlying C-type, we need a const_cast here.
|
163
|
+
data.refcounted.bytes = const_cast<uint8_t*>(bytes);
|
160
164
|
}
|
161
165
|
};
|
162
166
|
|
@@ -36,6 +36,7 @@
|
|
36
36
|
#include "src/core/lib/debug/stats.h"
|
37
37
|
#include "src/core/lib/gpr/alloc.h"
|
38
38
|
#include "src/core/lib/gpr/string.h"
|
39
|
+
#include "src/core/lib/gpr/time_precise.h"
|
39
40
|
#include "src/core/lib/gpr/useful.h"
|
40
41
|
#include "src/core/lib/gprpp/arena.h"
|
41
42
|
#include "src/core/lib/gprpp/manual_constructor.h"
|
@@ -154,7 +155,7 @@ struct grpc_call {
|
|
154
155
|
grpc_completion_queue* cq;
|
155
156
|
grpc_polling_entity pollent;
|
156
157
|
grpc_channel* channel;
|
157
|
-
|
158
|
+
gpr_cycle_counter start_time = gpr_get_cycle_counter();
|
158
159
|
/* parent_call* */ gpr_atm parent_call_atm = 0;
|
159
160
|
child_call* child = nullptr;
|
160
161
|
|
@@ -552,8 +553,7 @@ static void destroy_call(void* call, grpc_error* error) {
|
|
552
553
|
&(c->final_info.error_string));
|
553
554
|
GRPC_ERROR_UNREF(status_error);
|
554
555
|
c->final_info.stats.latency =
|
555
|
-
|
556
|
-
|
556
|
+
gpr_cycle_counter_sub(gpr_get_cycle_counter(), c->start_time);
|
557
557
|
grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), &c->final_info,
|
558
558
|
GRPC_CLOSURE_INIT(&c->release_call, release_call, c,
|
559
559
|
grpc_schedule_on_exec_ctx));
|
@@ -910,6 +910,9 @@ static int prepare_application_metadata(grpc_call* call, int count,
|
|
910
910
|
"validate_metadata",
|
911
911
|
grpc_validate_header_nonbin_value_is_legal(md->value))) {
|
912
912
|
break;
|
913
|
+
} else if (GRPC_SLICE_LENGTH(md->value) >= UINT32_MAX) {
|
914
|
+
// HTTP2 hpack encoding has a maximum limit.
|
915
|
+
break;
|
913
916
|
}
|
914
917
|
l->md = grpc_mdelem_from_grpc_metadata(const_cast<grpc_metadata*>(md));
|
915
918
|
}
|
@@ -1007,13 +1010,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
|
|
1007
1010
|
GPR_TIMER_SCOPE("incoming_stream_compression_algorithm", 0);
|
1008
1011
|
set_incoming_stream_compression_algorithm(
|
1009
1012
|
call, decode_stream_compression(b->idx.named.content_encoding->md));
|
1010
|
-
grpc_metadata_batch_remove(b,
|
1013
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_ENCODING);
|
1011
1014
|
}
|
1012
1015
|
if (b->idx.named.grpc_encoding != nullptr) {
|
1013
1016
|
GPR_TIMER_SCOPE("incoming_message_compression_algorithm", 0);
|
1014
1017
|
set_incoming_message_compression_algorithm(
|
1015
1018
|
call, decode_message_compression(b->idx.named.grpc_encoding->md));
|
1016
|
-
grpc_metadata_batch_remove(b,
|
1019
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ENCODING);
|
1017
1020
|
}
|
1018
1021
|
uint32_t message_encodings_accepted_by_peer = 1u;
|
1019
1022
|
uint32_t stream_encodings_accepted_by_peer = 1u;
|
@@ -1021,13 +1024,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
|
|
1021
1024
|
GPR_TIMER_SCOPE("encodings_accepted_by_peer", 0);
|
1022
1025
|
set_encodings_accepted_by_peer(call, b->idx.named.grpc_accept_encoding->md,
|
1023
1026
|
&message_encodings_accepted_by_peer, false);
|
1024
|
-
grpc_metadata_batch_remove(b,
|
1027
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ACCEPT_ENCODING);
|
1025
1028
|
}
|
1026
1029
|
if (b->idx.named.accept_encoding != nullptr) {
|
1027
1030
|
GPR_TIMER_SCOPE("stream_encodings_accepted_by_peer", 0);
|
1028
1031
|
set_encodings_accepted_by_peer(call, b->idx.named.accept_encoding->md,
|
1029
1032
|
&stream_encodings_accepted_by_peer, true);
|
1030
|
-
grpc_metadata_batch_remove(b,
|
1033
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_ACCEPT_ENCODING);
|
1031
1034
|
}
|
1032
1035
|
call->encodings_accepted_by_peer =
|
1033
1036
|
grpc_compression_bitset_from_message_stream_compression_bitset(
|
@@ -1059,13 +1062,13 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b,
|
|
1059
1062
|
error = grpc_error_set_str(
|
1060
1063
|
error, GRPC_ERROR_STR_GRPC_MESSAGE,
|
1061
1064
|
grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md)));
|
1062
|
-
grpc_metadata_batch_remove(b,
|
1065
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_MESSAGE);
|
1063
1066
|
} else if (error != GRPC_ERROR_NONE) {
|
1064
1067
|
error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
|
1065
1068
|
grpc_empty_slice());
|
1066
1069
|
}
|
1067
1070
|
set_final_status(call, GRPC_ERROR_REF(error));
|
1068
|
-
grpc_metadata_batch_remove(b,
|
1071
|
+
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_STATUS);
|
1069
1072
|
GRPC_ERROR_UNREF(error);
|
1070
1073
|
} else if (!call->is_client) {
|
1071
1074
|
set_final_status(call, GRPC_ERROR_NONE);
|
@@ -1175,6 +1178,12 @@ static void post_batch_completion(batch_control* bctl) {
|
|
1175
1178
|
&call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]);
|
1176
1179
|
}
|
1177
1180
|
if (bctl->op.send_message) {
|
1181
|
+
if (bctl->op.payload->send_message.stream_write_closed &&
|
1182
|
+
error == GRPC_ERROR_NONE) {
|
1183
|
+
error = grpc_error_add_child(
|
1184
|
+
error, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1185
|
+
"Attempt to send message after stream was closed."));
|
1186
|
+
}
|
1178
1187
|
call->sending_message = false;
|
1179
1188
|
}
|
1180
1189
|
if (bctl->op.send_trailing_metadata) {
|
@@ -1359,64 +1368,95 @@ static void receiving_stream_ready_in_call_combiner(void* bctlp,
|
|
1359
1368
|
receiving_stream_ready(bctlp, error);
|
1360
1369
|
}
|
1361
1370
|
|
1371
|
+
static void GPR_ATTRIBUTE_NOINLINE
|
1372
|
+
handle_both_stream_and_msg_compression_set(grpc_call* call) {
|
1373
|
+
char* error_msg = nullptr;
|
1374
|
+
gpr_asprintf(&error_msg,
|
1375
|
+
"Incoming stream has both stream compression (%d) and message "
|
1376
|
+
"compression (%d).",
|
1377
|
+
call->incoming_stream_compression_algorithm,
|
1378
|
+
call->incoming_message_compression_algorithm);
|
1379
|
+
gpr_log(GPR_ERROR, "%s", error_msg);
|
1380
|
+
cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
|
1381
|
+
gpr_free(error_msg);
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
static void GPR_ATTRIBUTE_NOINLINE
|
1385
|
+
handle_error_parsing_compression_algorithm(grpc_call* call) {
|
1386
|
+
char* error_msg = nullptr;
|
1387
|
+
gpr_asprintf(&error_msg,
|
1388
|
+
"Error in incoming message compression (%d) or stream "
|
1389
|
+
"compression (%d).",
|
1390
|
+
call->incoming_stream_compression_algorithm,
|
1391
|
+
call->incoming_message_compression_algorithm);
|
1392
|
+
cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
|
1393
|
+
gpr_free(error_msg);
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
static void GPR_ATTRIBUTE_NOINLINE handle_invalid_compression(
|
1397
|
+
grpc_call* call, grpc_compression_algorithm compression_algorithm) {
|
1398
|
+
char* error_msg = nullptr;
|
1399
|
+
gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.",
|
1400
|
+
compression_algorithm);
|
1401
|
+
gpr_log(GPR_ERROR, "%s", error_msg);
|
1402
|
+
cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
|
1403
|
+
gpr_free(error_msg);
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_disabled(
|
1407
|
+
grpc_call* call, grpc_compression_algorithm compression_algorithm) {
|
1408
|
+
char* error_msg = nullptr;
|
1409
|
+
const char* algo_name = nullptr;
|
1410
|
+
grpc_compression_algorithm_name(compression_algorithm, &algo_name);
|
1411
|
+
gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
|
1412
|
+
algo_name);
|
1413
|
+
gpr_log(GPR_ERROR, "%s", error_msg);
|
1414
|
+
cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
|
1415
|
+
gpr_free(error_msg);
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_not_accepted(
|
1419
|
+
grpc_call* call, grpc_compression_algorithm compression_algorithm) {
|
1420
|
+
const char* algo_name = nullptr;
|
1421
|
+
grpc_compression_algorithm_name(compression_algorithm, &algo_name);
|
1422
|
+
gpr_log(GPR_ERROR,
|
1423
|
+
"Compression algorithm ('%s') not present in the bitset of "
|
1424
|
+
"accepted encodings ('0x%x')",
|
1425
|
+
algo_name, call->encodings_accepted_by_peer);
|
1426
|
+
}
|
1427
|
+
|
1362
1428
|
static void validate_filtered_metadata(batch_control* bctl) {
|
1363
1429
|
grpc_compression_algorithm compression_algorithm;
|
1364
1430
|
grpc_call* call = bctl->call;
|
1365
|
-
if (call->incoming_stream_compression_algorithm !=
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
gpr_asprintf(&error_msg,
|
1371
|
-
"Incoming stream has both stream compression (%d) and message "
|
1372
|
-
"compression (%d).",
|
1373
|
-
call->incoming_stream_compression_algorithm,
|
1374
|
-
call->incoming_message_compression_algorithm);
|
1375
|
-
gpr_log(GPR_ERROR, "%s", error_msg);
|
1376
|
-
cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
|
1377
|
-
gpr_free(error_msg);
|
1431
|
+
if (GPR_UNLIKELY(call->incoming_stream_compression_algorithm !=
|
1432
|
+
GRPC_STREAM_COMPRESS_NONE &&
|
1433
|
+
call->incoming_message_compression_algorithm !=
|
1434
|
+
GRPC_MESSAGE_COMPRESS_NONE)) {
|
1435
|
+
handle_both_stream_and_msg_compression_set(call);
|
1378
1436
|
} else if (
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
"compression (%d).",
|
1386
|
-
call->incoming_stream_compression_algorithm,
|
1387
|
-
call->incoming_message_compression_algorithm);
|
1388
|
-
cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
|
1389
|
-
gpr_free(error_msg);
|
1437
|
+
GPR_UNLIKELY(
|
1438
|
+
grpc_compression_algorithm_from_message_stream_compression_algorithm(
|
1439
|
+
&compression_algorithm,
|
1440
|
+
call->incoming_message_compression_algorithm,
|
1441
|
+
call->incoming_stream_compression_algorithm) == 0)) {
|
1442
|
+
handle_error_parsing_compression_algorithm(call);
|
1390
1443
|
} else {
|
1391
|
-
char* error_msg = nullptr;
|
1392
1444
|
const grpc_compression_options compression_options =
|
1393
1445
|
grpc_channel_compression_options(call->channel);
|
1394
|
-
if (compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT) {
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
} else if (grpc_compression_options_is_algorithm_enabled(
|
1400
|
-
&compression_options, compression_algorithm) == 0) {
|
1446
|
+
if (GPR_UNLIKELY(compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT)) {
|
1447
|
+
handle_invalid_compression(call, compression_algorithm);
|
1448
|
+
} else if (GPR_UNLIKELY(
|
1449
|
+
grpc_compression_options_is_algorithm_enabled_internal(
|
1450
|
+
&compression_options, compression_algorithm) == 0)) {
|
1401
1451
|
/* check if algorithm is supported by current channel config */
|
1402
|
-
|
1403
|
-
grpc_compression_algorithm_name(compression_algorithm, &algo_name);
|
1404
|
-
gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
|
1405
|
-
algo_name);
|
1406
|
-
gpr_log(GPR_ERROR, "%s", error_msg);
|
1407
|
-
cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
|
1452
|
+
handle_compression_algorithm_disabled(call, compression_algorithm);
|
1408
1453
|
}
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1454
|
+
/* GRPC_COMPRESS_NONE is always set. */
|
1455
|
+
GPR_DEBUG_ASSERT(call->encodings_accepted_by_peer != 0);
|
1456
|
+
if (GPR_UNLIKELY(!GPR_BITGET(call->encodings_accepted_by_peer,
|
1457
|
+
compression_algorithm))) {
|
1413
1458
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
|
1414
|
-
|
1415
|
-
grpc_compression_algorithm_name(compression_algorithm, &algo_name);
|
1416
|
-
gpr_log(GPR_ERROR,
|
1417
|
-
"Compression algorithm ('%s') not present in the bitset of "
|
1418
|
-
"accepted encodings ('0x%x')",
|
1419
|
-
algo_name, call->encodings_accepted_by_peer);
|
1459
|
+
handle_compression_algorithm_not_accepted(call, compression_algorithm);
|
1420
1460
|
}
|
1421
1461
|
}
|
1422
1462
|
}
|
@@ -417,10 +417,10 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method,
|
|
417
417
|
grpc_core::ExecCtx exec_ctx;
|
418
418
|
|
419
419
|
rc->path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH,
|
420
|
-
grpc_core::
|
420
|
+
grpc_core::ExternallyManagedSlice(method));
|
421
421
|
rc->authority =
|
422
422
|
host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
|
423
|
-
grpc_core::
|
423
|
+
grpc_core::ExternallyManagedSlice(host))
|
424
424
|
: GRPC_MDNULL;
|
425
425
|
gpr_mu_lock(&channel->registered_call_mu);
|
426
426
|
rc->next = channel->registered_calls;
|
@@ -320,7 +320,7 @@ struct cq_callback_data {
|
|
320
320
|
/* Completion queue structure */
|
321
321
|
struct grpc_completion_queue {
|
322
322
|
/** Once owning_refs drops to zero, we will destroy the cq */
|
323
|
-
|
323
|
+
grpc_core::RefCount owning_refs;
|
324
324
|
|
325
325
|
gpr_mu* mu;
|
326
326
|
|
@@ -518,7 +518,7 @@ grpc_completion_queue* grpc_completion_queue_create_internal(
|
|
518
518
|
cq->poller_vtable = poller_vtable;
|
519
519
|
|
520
520
|
/* One for destroy(), one for pollset_shutdown */
|
521
|
-
|
521
|
+
new (&cq->owning_refs) grpc_core::RefCount(2);
|
522
522
|
|
523
523
|
poller_vtable->init(POLLSET_FROM_CQ(cq), &cq->mu);
|
524
524
|
vtable->init(DATA_FROM_CQ(cq), shutdown_callback);
|
@@ -573,16 +573,13 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cq) {
|
|
573
573
|
#ifndef NDEBUG
|
574
574
|
void grpc_cq_internal_ref(grpc_completion_queue* cq, const char* reason,
|
575
575
|
const char* file, int line) {
|
576
|
-
|
577
|
-
gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count);
|
578
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
579
|
-
"CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val + 1,
|
580
|
-
reason);
|
581
|
-
}
|
576
|
+
grpc_core::DebugLocation debug_location(file, line);
|
582
577
|
#else
|
583
578
|
void grpc_cq_internal_ref(grpc_completion_queue* cq) {
|
579
|
+
grpc_core::DebugLocation debug_location;
|
580
|
+
const char* reason = nullptr;
|
584
581
|
#endif
|
585
|
-
|
582
|
+
cq->owning_refs.Ref(debug_location, reason);
|
586
583
|
}
|
587
584
|
|
588
585
|
static void on_pollset_shutdown_done(void* arg, grpc_error* error) {
|
@@ -593,16 +590,13 @@ static void on_pollset_shutdown_done(void* arg, grpc_error* error) {
|
|
593
590
|
#ifndef NDEBUG
|
594
591
|
void grpc_cq_internal_unref(grpc_completion_queue* cq, const char* reason,
|
595
592
|
const char* file, int line) {
|
596
|
-
|
597
|
-
gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count);
|
598
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
599
|
-
"CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val - 1,
|
600
|
-
reason);
|
601
|
-
}
|
593
|
+
grpc_core::DebugLocation debug_location(file, line);
|
602
594
|
#else
|
603
595
|
void grpc_cq_internal_unref(grpc_completion_queue* cq) {
|
596
|
+
grpc_core::DebugLocation debug_location;
|
597
|
+
const char* reason = nullptr;
|
604
598
|
#endif
|
605
|
-
if (
|
599
|
+
if (GPR_UNLIKELY(cq->owning_refs.Unref(debug_location, reason))) {
|
606
600
|
cq->vtable->destroy(DATA_FROM_CQ(cq));
|
607
601
|
cq->poller_vtable->destroy(POLLSET_FROM_CQ(cq));
|
608
602
|
#ifndef NDEBUG
|
@@ -134,6 +134,7 @@ void grpc_init(void) {
|
|
134
134
|
grpc_core::Fork::GlobalInit();
|
135
135
|
grpc_fork_handlers_auto_register();
|
136
136
|
grpc_stats_init();
|
137
|
+
grpc_init_static_metadata_ctx();
|
137
138
|
grpc_slice_intern_init();
|
138
139
|
grpc_mdctx_global_init();
|
139
140
|
grpc_channel_init_init();
|
@@ -191,6 +192,8 @@ void grpc_shutdown_internal_locked(void) {
|
|
191
192
|
grpc_core::ApplicationCallbackExecCtx::GlobalShutdown();
|
192
193
|
g_shutting_down = false;
|
193
194
|
gpr_cv_broadcast(g_shutting_down_cv);
|
195
|
+
// Absolute last action will be to delete static metadata context.
|
196
|
+
grpc_destroy_static_metadata_ctx();
|
194
197
|
}
|
195
198
|
|
196
199
|
void grpc_shutdown_internal(void* ignored) {
|
@@ -256,7 +256,7 @@ struct grpc_server {
|
|
256
256
|
|
257
257
|
listener* listeners;
|
258
258
|
int listeners_destroyed;
|
259
|
-
|
259
|
+
grpc_core::RefCount internal_refcount;
|
260
260
|
|
261
261
|
/** when did we print the last shutdown progress message */
|
262
262
|
gpr_timespec last_shutdown_message_time;
|
@@ -400,9 +400,7 @@ static void request_matcher_kill_requests(grpc_server* server,
|
|
400
400
|
* server proper
|
401
401
|
*/
|
402
402
|
|
403
|
-
static void server_ref(grpc_server* server) {
|
404
|
-
gpr_ref(&server->internal_refcount);
|
405
|
-
}
|
403
|
+
static void server_ref(grpc_server* server) { server->internal_refcount.Ref(); }
|
406
404
|
|
407
405
|
static void server_delete(grpc_server* server) {
|
408
406
|
registered_method* rm;
|
@@ -434,7 +432,7 @@ static void server_delete(grpc_server* server) {
|
|
434
432
|
}
|
435
433
|
|
436
434
|
static void server_unref(grpc_server* server) {
|
437
|
-
if (
|
435
|
+
if (GPR_UNLIKELY(server->internal_refcount.Unref())) {
|
438
436
|
server_delete(server);
|
439
437
|
}
|
440
438
|
}
|
@@ -631,7 +629,7 @@ static void start_new_rpc(grpc_call_element* elem) {
|
|
631
629
|
for (i = 0; i <= chand->registered_method_max_probes; i++) {
|
632
630
|
rm = &chand->registered_methods[(hash + i) %
|
633
631
|
chand->registered_method_slots];
|
634
|
-
if (rm
|
632
|
+
if (!rm) break;
|
635
633
|
if (!rm->has_host) continue;
|
636
634
|
if (!grpc_slice_eq(rm->host, calld->host)) continue;
|
637
635
|
if (!grpc_slice_eq(rm->method, calld->path)) continue;
|
@@ -649,7 +647,7 @@ static void start_new_rpc(grpc_call_element* elem) {
|
|
649
647
|
for (i = 0; i <= chand->registered_method_max_probes; i++) {
|
650
648
|
rm = &chand->registered_methods[(hash + i) %
|
651
649
|
chand->registered_method_slots];
|
652
|
-
if (rm
|
650
|
+
if (!rm) break;
|
653
651
|
if (rm->has_host) continue;
|
654
652
|
if (!grpc_slice_eq(rm->method, calld->path)) continue;
|
655
653
|
if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) &&
|
@@ -746,19 +744,18 @@ static void server_on_recv_initial_metadata(void* ptr, grpc_error* error) {
|
|
746
744
|
grpc_millis op_deadline;
|
747
745
|
|
748
746
|
if (error == GRPC_ERROR_NONE) {
|
749
|
-
|
750
|
-
|
747
|
+
GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr);
|
748
|
+
GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.authority !=
|
749
|
+
nullptr);
|
751
750
|
calld->path = grpc_slice_ref_internal(
|
752
751
|
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
|
753
752
|
calld->host = grpc_slice_ref_internal(
|
754
753
|
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
|
755
754
|
calld->path_set = true;
|
756
755
|
calld->host_set = true;
|
756
|
+
grpc_metadata_batch_remove(calld->recv_initial_metadata, GRPC_BATCH_PATH);
|
757
757
|
grpc_metadata_batch_remove(calld->recv_initial_metadata,
|
758
|
-
|
759
|
-
grpc_metadata_batch_remove(
|
760
|
-
calld->recv_initial_metadata,
|
761
|
-
calld->recv_initial_metadata->idx.named.authority);
|
758
|
+
GRPC_BATCH_AUTHORITY);
|
762
759
|
} else {
|
763
760
|
GRPC_ERROR_REF(error);
|
764
761
|
}
|
@@ -1031,7 +1028,7 @@ grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) {
|
|
1031
1028
|
gpr_cv_init(&server->starting_cv);
|
1032
1029
|
|
1033
1030
|
/* decremented by grpc_server_destroy */
|
1034
|
-
|
1031
|
+
new (&server->internal_refcount) grpc_core::RefCount();
|
1035
1032
|
server->root_channel_data.next = server->root_channel_data.prev =
|
1036
1033
|
&server->root_channel_data;
|
1037
1034
|
|