grpc 1.12.0 → 1.13.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 +314 -23
- data/include/grpc/impl/codegen/fork.h +4 -4
- data/include/grpc/impl/codegen/grpc_types.h +1 -1
- data/include/grpc/impl/codegen/port_platform.h +3 -0
- data/src/boringssl/err_data.c +256 -246
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +367 -272
- data/src/core/ext/filters/client_channel/lb_policy.h +1 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +42 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +36 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +36 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +37 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +22 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver.h +1 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +3 -3
- 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_wrapper.cc +0 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/subchannel.cc +3 -3
- data/src/core/ext/filters/http/client_authority_filter.cc +5 -4
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +4 -4
- data/src/core/ext/filters/http/server/http_server_filter.cc +123 -131
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +9 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +19 -19
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +10 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/writing.cc +6 -6
- data/src/core/lib/channel/channel_stack.cc +0 -5
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/channel_stack_builder.cc +0 -3
- data/src/core/lib/channel/channel_stack_builder.h +0 -2
- data/src/core/lib/channel/channel_trace.cc +3 -3
- data/src/core/lib/channel/channelz_registry.cc +77 -0
- data/src/core/lib/channel/channelz_registry.h +99 -0
- data/src/core/lib/channel/handshaker.cc +20 -1
- data/src/core/lib/debug/stats.h +7 -0
- data/src/core/lib/debug/stats_data.cc +5 -0
- data/src/core/lib/debug/stats_data.h +120 -0
- data/src/core/lib/debug/trace.h +11 -9
- data/src/core/lib/gprpp/fork.cc +260 -0
- data/src/core/lib/gprpp/fork.h +79 -0
- data/src/core/lib/gprpp/memory.h +12 -0
- data/src/core/lib/gprpp/orphanable.h +2 -6
- data/src/core/lib/gprpp/ref_counted.h +2 -6
- data/src/core/lib/gprpp/thd.h +0 -3
- data/src/core/lib/gprpp/thd_posix.cc +4 -53
- data/src/core/lib/gprpp/thd_windows.cc +0 -7
- data/src/core/lib/http/httpcli_security_connector.cc +1 -3
- data/src/core/lib/iomgr/combiner.cc +19 -2
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -2
- data/src/core/lib/iomgr/ev_epollex_linux.cc +59 -3
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -2
- data/src/core/lib/iomgr/ev_posix.cc +11 -4
- data/src/core/lib/iomgr/ev_posix.h +6 -0
- data/src/core/lib/iomgr/exec_ctx.cc +9 -9
- data/src/core/lib/iomgr/exec_ctx.h +39 -20
- data/src/core/lib/iomgr/fork_posix.cc +30 -18
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/polling_entity.cc +11 -2
- data/src/core/lib/iomgr/pollset_custom.cc +2 -2
- data/src/core/lib/iomgr/port.h +38 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +1 -1
- data/src/core/lib/iomgr/resource_quota.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_posix.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_client_custom.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -2
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +18 -10
- data/src/core/lib/iomgr/tcp_server_posix.cc +9 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +16 -4
- data/src/core/lib/iomgr/timer.h +1 -1
- data/src/core/lib/iomgr/timer_generic.cc +113 -41
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/security/credentials/credentials.h +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +88 -115
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +16 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +10 -6
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
- data/src/core/lib/security/security_connector/alts_security_connector.cc +2 -1
- data/src/core/lib/security/security_connector/security_connector.cc +7 -7
- data/src/core/lib/security/transport/security_handshaker.cc +1 -0
- data/src/core/lib/security/util/json_util.cc +4 -0
- data/src/core/lib/slice/slice_buffer.cc +15 -3
- data/src/core/lib/surface/call.cc +31 -17
- data/src/core/lib/surface/call.h +5 -0
- data/src/core/lib/surface/channel.cc +2 -5
- data/src/core/lib/surface/completion_queue.cc +1 -3
- data/src/core/lib/surface/completion_queue.h +0 -1
- data/src/core/lib/surface/init.cc +7 -8
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.cc +1 -1
- data/src/core/lib/transport/transport.cc +2 -1
- data/src/core/lib/transport/transport.h +4 -8
- data/src/core/lib/transport/transport_op_string.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +19 -7
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +10 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +28 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -0
- data/src/core/tsi/fake_transport_security.cc +1 -0
- data/src/core/tsi/ssl_transport_security.cc +238 -110
- data/src/core/tsi/transport_security.cc +14 -0
- data/src/core/tsi/transport_security.h +2 -0
- data/src/core/tsi/transport_security_interface.h +11 -1
- data/src/ruby/bin/math_client.rb +17 -9
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +4 -1
- data/third_party/boringssl/crypto/asn1/a_int.c +33 -28
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +24 -22
- data/third_party/boringssl/crypto/asn1/a_utf8.c +13 -11
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
- data/third_party/boringssl/crypto/bio/fd.c +1 -0
- data/third_party/boringssl/crypto/bio/file.c +2 -0
- data/third_party/boringssl/crypto/bn_extra/convert.c +6 -5
- data/third_party/boringssl/crypto/bytestring/ber.c +1 -4
- data/third_party/boringssl/crypto/bytestring/cbb.c +116 -16
- data/third_party/boringssl/crypto/bytestring/cbs.c +150 -20
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +171 -0
- data/third_party/boringssl/crypto/cipher_extra/e_rc2.c +2 -0
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +1 -2
- data/third_party/boringssl/crypto/cpu-aarch64-fuchsia.c +55 -0
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +2 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +16 -54
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +11 -542
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +33 -64
- data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +122 -70
- data/third_party/boringssl/crypto/fipsmodule/bn/bytes.c +32 -71
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +58 -112
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +198 -122
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +31 -65
- data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +2 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +98 -15
- data/third_party/boringssl/crypto/fipsmodule/bn/jacobi.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +124 -81
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +8 -30
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +303 -347
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +2 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +3 -4
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +199 -222
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +27 -47
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +45 -28
- data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +10 -10
- data/third_party/boringssl/crypto/fipsmodule/des/internal.h +2 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +78 -47
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +35 -54
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +3 -10
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +36 -22
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +59 -90
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +29 -48
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -26
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +15 -11
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +45 -51
- data/third_party/boringssl/crypto/fipsmodule/ec/{util-64.c → util.c} +0 -5
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +144 -264
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +78 -56
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +256 -0
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +36 -32
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +9 -7
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +16 -10
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +255 -102
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +581 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/internal.h +39 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/kdf.c +165 -0
- data/third_party/boringssl/crypto/internal.h +65 -2
- data/third_party/boringssl/crypto/mem.c +0 -2
- data/third_party/boringssl/crypto/obj/obj.c +6 -73
- data/third_party/boringssl/crypto/thread_pthread.c +35 -5
- data/third_party/boringssl/crypto/x509/a_strex.c +11 -11
- data/third_party/boringssl/crypto/x509/x_name.c +13 -0
- data/third_party/boringssl/include/openssl/aead.h +4 -0
- data/third_party/boringssl/include/openssl/asn1.h +1 -3
- data/third_party/boringssl/include/openssl/base.h +1 -14
- data/third_party/boringssl/include/openssl/bio.h +1 -1
- data/third_party/boringssl/include/openssl/bn.h +49 -15
- data/third_party/boringssl/include/openssl/bytestring.h +49 -24
- data/third_party/boringssl/include/openssl/crypto.h +4 -0
- data/third_party/boringssl/include/openssl/ec_key.h +7 -3
- data/third_party/boringssl/include/openssl/err.h +9 -9
- data/third_party/boringssl/include/openssl/evp.h +1 -1
- data/third_party/boringssl/include/openssl/rsa.h +34 -10
- data/third_party/boringssl/include/openssl/ssl.h +160 -17
- data/third_party/boringssl/include/openssl/stack.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +10 -2
- data/third_party/boringssl/include/openssl/x509.h +3 -0
- data/third_party/boringssl/ssl/d1_both.cc +16 -2
- data/third_party/boringssl/ssl/dtls_method.cc +1 -1
- data/third_party/boringssl/ssl/handoff.cc +285 -0
- data/third_party/boringssl/ssl/handshake.cc +26 -12
- data/third_party/boringssl/ssl/handshake_client.cc +65 -31
- data/third_party/boringssl/ssl/handshake_server.cc +14 -2
- data/third_party/boringssl/ssl/internal.h +132 -79
- data/third_party/boringssl/ssl/s3_both.cc +2 -2
- data/third_party/boringssl/ssl/s3_lib.cc +3 -1
- data/third_party/boringssl/ssl/s3_pkt.cc +0 -18
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +1 -4
- data/third_party/boringssl/ssl/ssl_asn1.cc +47 -43
- data/third_party/boringssl/ssl/ssl_cipher.cc +8 -8
- data/third_party/boringssl/ssl/ssl_key_share.cc +3 -1
- data/third_party/boringssl/ssl/ssl_lib.cc +83 -14
- data/third_party/boringssl/ssl/ssl_privkey.cc +6 -0
- data/third_party/boringssl/ssl/ssl_stat.cc +6 -6
- data/third_party/boringssl/ssl/ssl_versions.cc +12 -85
- data/third_party/boringssl/ssl/ssl_x509.cc +59 -61
- data/third_party/boringssl/ssl/t1_enc.cc +73 -124
- data/third_party/boringssl/ssl/t1_lib.cc +367 -41
- data/third_party/boringssl/ssl/tls13_both.cc +8 -0
- data/third_party/boringssl/ssl/tls13_client.cc +98 -184
- data/third_party/boringssl/ssl/tls13_enc.cc +88 -158
- data/third_party/boringssl/ssl/tls13_server.cc +91 -137
- data/third_party/boringssl/ssl/tls_method.cc +0 -17
- data/third_party/boringssl/ssl/tls_record.cc +1 -10
- data/third_party/boringssl/third_party/fiat/curve25519.c +921 -2753
- data/third_party/boringssl/third_party/fiat/curve25519_tables.h +7880 -0
- data/third_party/boringssl/third_party/fiat/internal.h +32 -20
- data/third_party/boringssl/third_party/fiat/p256.c +1824 -0
- metadata +64 -64
- data/src/core/lib/channel/channel_trace_registry.cc +0 -80
- data/src/core/lib/channel/channel_trace_registry.h +0 -43
- data/src/core/lib/gpr/fork.cc +0 -78
- data/src/core/lib/gpr/fork.h +0 -35
- data/src/core/tsi/transport_security_adapter.cc +0 -235
- data/src/core/tsi/transport_security_adapter.h +0 -41
- data/src/ruby/bin/apis/google/protobuf/empty.rb +0 -29
- data/src/ruby/bin/apis/pubsub_demo.rb +0 -241
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +0 -159
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +0 -88
- data/src/ruby/pb/test/client.rb +0 -764
- data/src/ruby/pb/test/server.rb +0 -252
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +0 -247
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +0 -1674
@@ -179,8 +179,8 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
|
|
179
179
|
grpc_handshake_manager* handshake_mgr = grpc_handshake_manager_create();
|
180
180
|
grpc_handshake_manager_pending_list_add(&state->pending_handshake_mgrs,
|
181
181
|
handshake_mgr);
|
182
|
-
gpr_mu_unlock(&state->mu);
|
183
182
|
grpc_tcp_server_ref(state->tcp_server);
|
183
|
+
gpr_mu_unlock(&state->mu);
|
184
184
|
server_connection_state* connection_state =
|
185
185
|
static_cast<server_connection_state*>(
|
186
186
|
gpr_zalloc(sizeof(*connection_state)));
|
@@ -55,7 +55,7 @@ static bool input_is_valid(uint8_t* input_ptr, size_t length) {
|
|
55
55
|
size_t i;
|
56
56
|
|
57
57
|
for (i = 0; i < length; ++i) {
|
58
|
-
if ((decode_table[input_ptr[i]] & 0xC0) != 0) {
|
58
|
+
if (GPR_UNLIKELY((decode_table[input_ptr[i]] & 0xC0) != 0)) {
|
59
59
|
gpr_log(GPR_ERROR,
|
60
60
|
"Base64 decoding failed, invalid character '%c' in base64 "
|
61
61
|
"input.\n",
|
@@ -86,14 +86,14 @@ size_t grpc_chttp2_base64_infer_length_after_decode(const grpc_slice& slice) {
|
|
86
86
|
while (len > 0 && bytes[len - 1] == '=') {
|
87
87
|
len--;
|
88
88
|
}
|
89
|
-
if (GRPC_SLICE_LENGTH(slice) - len > 2) {
|
89
|
+
if (GPR_UNLIKELY(GRPC_SLICE_LENGTH(slice) - len > 2)) {
|
90
90
|
gpr_log(GPR_ERROR,
|
91
91
|
"Base64 decoding failed. Input has more than 2 paddings.");
|
92
92
|
return 0;
|
93
93
|
}
|
94
94
|
size_t tuples = len / 4;
|
95
95
|
size_t tail_case = len % 4;
|
96
|
-
if (tail_case == 1) {
|
96
|
+
if (GPR_UNLIKELY(tail_case == 1)) {
|
97
97
|
gpr_log(GPR_ERROR,
|
98
98
|
"Base64 decoding failed. Input has a length of %zu (without"
|
99
99
|
" padding), which is invalid.\n",
|
@@ -164,7 +164,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
|
|
164
164
|
struct grpc_base64_decode_context ctx;
|
165
165
|
grpc_slice output;
|
166
166
|
|
167
|
-
if (input_length % 4 != 0) {
|
167
|
+
if (GPR_UNLIKELY(input_length % 4 != 0)) {
|
168
168
|
gpr_log(GPR_ERROR,
|
169
169
|
"Base64 decoding failed, input of "
|
170
170
|
"grpc_chttp2_base64_decode has a length of %d, which is not a "
|
@@ -190,7 +190,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
|
|
190
190
|
ctx.output_end = GRPC_SLICE_END_PTR(output);
|
191
191
|
ctx.contains_tail = false;
|
192
192
|
|
193
|
-
if (!grpc_base64_decode_partial(&ctx)) {
|
193
|
+
if (GPR_UNLIKELY(!grpc_base64_decode_partial(&ctx))) {
|
194
194
|
char* s = grpc_slice_to_c_string(input);
|
195
195
|
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
|
196
196
|
gpr_free(s);
|
@@ -209,7 +209,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
|
|
209
209
|
struct grpc_base64_decode_context ctx;
|
210
210
|
|
211
211
|
// The length of a base64 string cannot be 4 * n + 1
|
212
|
-
if (input_length % 4 == 1) {
|
212
|
+
if (GPR_UNLIKELY(input_length % 4 == 1)) {
|
213
213
|
gpr_log(GPR_ERROR,
|
214
214
|
"Base64 decoding failed, input of "
|
215
215
|
"grpc_chttp2_base64_decode_with_length has a length of %d, which "
|
@@ -219,7 +219,8 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
|
|
219
219
|
return grpc_empty_slice();
|
220
220
|
}
|
221
221
|
|
222
|
-
if (output_length >
|
222
|
+
if (GPR_UNLIKELY(output_length >
|
223
|
+
input_length / 4 * 3 + tail_xtra[input_length % 4])) {
|
223
224
|
gpr_log(
|
224
225
|
GPR_ERROR,
|
225
226
|
"Base64 decoding failed, output_length %d is longer "
|
@@ -236,7 +237,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
|
|
236
237
|
ctx.output_end = GRPC_SLICE_END_PTR(output);
|
237
238
|
ctx.contains_tail = true;
|
238
239
|
|
239
|
-
if (!grpc_base64_decode_partial(&ctx)) {
|
240
|
+
if (GPR_UNLIKELY(!grpc_base64_decode_partial(&ctx))) {
|
240
241
|
char* s = grpc_slice_to_c_string(input);
|
241
242
|
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
|
242
243
|
gpr_free(s);
|
@@ -718,7 +718,7 @@ static void destroy_stream_locked(void* sp, grpc_error* error) {
|
|
718
718
|
grpc_chttp2_list_remove_stalled_by_stream(t, s);
|
719
719
|
|
720
720
|
for (int i = 0; i < STREAM_LIST_COUNT; i++) {
|
721
|
-
if (s->included[i]) {
|
721
|
+
if (GPR_UNLIKELY(s->included[i])) {
|
722
722
|
gpr_log(GPR_ERROR, "%s stream %d still included in list %d",
|
723
723
|
t->is_client ? "client" : "server", s->id, i);
|
724
724
|
abort();
|
@@ -1088,8 +1088,9 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
|
|
1088
1088
|
* data equal to "too_many_pings", it should log the occurrence at a log level
|
1089
1089
|
* that is enabled by default and double the configured KEEPALIVE_TIME used
|
1090
1090
|
* for new connections on that channel. */
|
1091
|
-
if (t->is_client &&
|
1092
|
-
|
1091
|
+
if (GPR_UNLIKELY(t->is_client &&
|
1092
|
+
goaway_error == GRPC_HTTP2_ENHANCE_YOUR_CALM &&
|
1093
|
+
grpc_slice_str_cmp(goaway_text, "too_many_pings") == 0)) {
|
1093
1094
|
gpr_log(GPR_ERROR,
|
1094
1095
|
"Received a GOAWAY with error code ENHANCE_YOUR_CALM and debug "
|
1095
1096
|
"data equal to \"too_many_pings\"");
|
@@ -1450,10 +1451,8 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1450
1451
|
}
|
1451
1452
|
}
|
1452
1453
|
if (op_payload->send_initial_metadata.peer_string != nullptr) {
|
1453
|
-
|
1454
|
-
|
1455
|
-
(gpr_atm)gpr_strdup(t->peer_string));
|
1456
|
-
gpr_free(old_peer_string);
|
1454
|
+
gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
|
1455
|
+
(gpr_atm)t->peer_string);
|
1457
1456
|
}
|
1458
1457
|
}
|
1459
1458
|
|
@@ -1568,10 +1567,8 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1568
1567
|
s->trailing_metadata_available =
|
1569
1568
|
op_payload->recv_initial_metadata.trailing_metadata_available;
|
1570
1569
|
if (op_payload->recv_initial_metadata.peer_string != nullptr) {
|
1571
|
-
|
1572
|
-
|
1573
|
-
(gpr_atm)gpr_strdup(t->peer_string));
|
1574
|
-
gpr_free(old_peer_string);
|
1570
|
+
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
|
1571
|
+
(gpr_atm)t->peer_string);
|
1575
1572
|
}
|
1576
1573
|
grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
|
1577
1574
|
}
|
@@ -1683,16 +1680,16 @@ static void send_ping_locked(grpc_chttp2_transport* t,
|
|
1683
1680
|
*/
|
1684
1681
|
static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
1685
1682
|
if (t->closed_with_error != GRPC_ERROR_NONE) {
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1683
|
+
GRPC_CLOSURE_RUN(&t->start_keepalive_ping_locked,
|
1684
|
+
GRPC_ERROR_REF(t->closed_with_error));
|
1685
|
+
GRPC_CLOSURE_RUN(&t->finish_keepalive_ping_locked,
|
1686
|
+
GRPC_ERROR_REF(t->closed_with_error));
|
1690
1687
|
return;
|
1691
1688
|
}
|
1692
1689
|
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
1693
1690
|
if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_INFLIGHT])) {
|
1694
1691
|
/* There is a ping in flight. Add yourself to the inflight closure list. */
|
1695
|
-
|
1692
|
+
GRPC_CLOSURE_RUN(&t->start_keepalive_ping_locked, GRPC_ERROR_NONE);
|
1696
1693
|
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT],
|
1697
1694
|
&t->finish_keepalive_ping_locked, GRPC_ERROR_NONE);
|
1698
1695
|
return;
|
@@ -1800,8 +1797,11 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1800
1797
|
|
1801
1798
|
static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
|
1802
1799
|
grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
|
1803
|
-
|
1804
|
-
|
1800
|
+
if (grpc_http_trace.enabled()) {
|
1801
|
+
char* msg = grpc_transport_op_string(op);
|
1802
|
+
gpr_log(GPR_INFO, "perform_transport_op[t=%p]: %s", t, msg);
|
1803
|
+
gpr_free(msg);
|
1804
|
+
}
|
1805
1805
|
op->handler_private.extra_arg = gt;
|
1806
1806
|
GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
|
1807
1807
|
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&op->handler_private.closure,
|
@@ -2701,7 +2701,7 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
|
|
2701
2701
|
} else {
|
2702
2702
|
/* The watchdog timer should have been cancelled by
|
2703
2703
|
* finish_keepalive_ping_locked. */
|
2704
|
-
if (error != GRPC_ERROR_CANCELLED) {
|
2704
|
+
if (GPR_UNLIKELY(error != GRPC_ERROR_CANCELLED)) {
|
2705
2705
|
gpr_log(GPR_ERROR, "keepalive_ping_end state error: %d (expect: %d)",
|
2706
2706
|
t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
|
2707
2707
|
}
|
@@ -41,14 +41,18 @@
|
|
41
41
|
#include "src/core/lib/transport/static_metadata.h"
|
42
42
|
#include "src/core/lib/transport/timeout_encoding.h"
|
43
43
|
|
44
|
-
#define
|
45
|
-
#define
|
46
|
-
#define
|
47
|
-
|
44
|
+
#define HASH_FRAGMENT_MASK (GRPC_CHTTP2_HPACKC_NUM_VALUES - 1)
|
45
|
+
#define HASH_FRAGMENT_1(x) ((x)&HASH_FRAGMENT_MASK)
|
46
|
+
#define HASH_FRAGMENT_2(x) \
|
47
|
+
(((x) >> GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) & HASH_FRAGMENT_MASK)
|
48
|
+
#define HASH_FRAGMENT_3(x) \
|
49
|
+
(((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 2)) & HASH_FRAGMENT_MASK)
|
50
|
+
#define HASH_FRAGMENT_4(x) \
|
51
|
+
(((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 3)) & HASH_FRAGMENT_MASK)
|
48
52
|
|
49
53
|
/* if the probability of this item being seen again is < 1/x then don't add
|
50
54
|
it to the table */
|
51
|
-
#define ONE_ON_ADD_PROBABILITY
|
55
|
+
#define ONE_ON_ADD_PROBABILITY (GRPC_CHTTP2_HPACKC_NUM_VALUES >> 1)
|
52
56
|
/* don't consider adding anything bigger than this to the hpack table */
|
53
57
|
#define MAX_DECODER_SPACE_USAGE 512
|
54
58
|
|
@@ -135,7 +139,7 @@ static void inc_filter(uint8_t idx, uint32_t* sum, uint8_t* elems) {
|
|
135
139
|
} else {
|
136
140
|
int i;
|
137
141
|
*sum = 0;
|
138
|
-
for (i = 0; i <
|
142
|
+
for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) {
|
139
143
|
elems[i] /= 2;
|
140
144
|
(*sum) += elems[i];
|
141
145
|
}
|
@@ -28,8 +28,9 @@
|
|
28
28
|
#include "src/core/lib/transport/metadata_batch.h"
|
29
29
|
#include "src/core/lib/transport/transport.h"
|
30
30
|
|
31
|
-
|
32
|
-
#define
|
31
|
+
// This should be <= 8. We use 6 to save space.
|
32
|
+
#define GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS 6
|
33
|
+
#define GRPC_CHTTP2_HPACKC_NUM_VALUES (1 << GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS)
|
33
34
|
/* initial table size, per spec */
|
34
35
|
#define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096
|
35
36
|
/* maximum table size we'll actually use */
|
@@ -58,7 +59,7 @@ typedef struct {
|
|
58
59
|
a new literal should be added to the compression table or not.
|
59
60
|
They track a single integer that counts how often a particular value has
|
60
61
|
been seen. When that count reaches max (255), all values are halved. */
|
61
|
-
uint8_t filter_elems[
|
62
|
+
uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
62
63
|
|
63
64
|
/* entry tables for keys & elems: these tables track values that have been
|
64
65
|
seen and *may* be in the decompressor table */
|
@@ -422,7 +422,8 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
|
|
422
422
|
if (cached_timeout != nullptr) {
|
423
423
|
timeout = *cached_timeout;
|
424
424
|
} else {
|
425
|
-
if (
|
425
|
+
if (GPR_UNLIKELY(
|
426
|
+
!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) {
|
426
427
|
char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
|
427
428
|
gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val);
|
428
429
|
gpr_free(val);
|
@@ -550,15 +551,15 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
|
|
550
551
|
/* could be a new grpc_chttp2_stream or an existing grpc_chttp2_stream */
|
551
552
|
s = grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
|
552
553
|
if (s == nullptr) {
|
553
|
-
if (is_continuation) {
|
554
|
+
if (GPR_UNLIKELY(is_continuation)) {
|
554
555
|
GRPC_CHTTP2_IF_TRACING(
|
555
556
|
gpr_log(GPR_ERROR,
|
556
557
|
"grpc_chttp2_stream disbanded before CONTINUATION received"));
|
557
558
|
return init_skip_frame_parser(t, 1);
|
558
559
|
}
|
559
560
|
if (t->is_client) {
|
560
|
-
if ((t->incoming_stream_id & 1) &&
|
561
|
-
|
561
|
+
if (GPR_LIKELY((t->incoming_stream_id & 1) &&
|
562
|
+
t->incoming_stream_id < t->next_stream_id)) {
|
562
563
|
/* this is an old (probably cancelled) grpc_chttp2_stream */
|
563
564
|
} else {
|
564
565
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
@@ -569,7 +570,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
|
|
569
570
|
grpc_chttp2_hpack_parser_set_has_priority(&t->hpack_parser);
|
570
571
|
}
|
571
572
|
return err;
|
572
|
-
} else if (t->last_new_stream_id >= t->incoming_stream_id) {
|
573
|
+
} else if (GPR_UNLIKELY(t->last_new_stream_id >= t->incoming_stream_id)) {
|
573
574
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
574
575
|
GPR_ERROR,
|
575
576
|
"ignoring out of order new grpc_chttp2_stream request on server; "
|
@@ -577,21 +578,22 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
|
|
577
578
|
"id=%d, new grpc_chttp2_stream id=%d",
|
578
579
|
t->last_new_stream_id, t->incoming_stream_id));
|
579
580
|
return init_skip_frame_parser(t, 1);
|
580
|
-
} else if ((t->incoming_stream_id & 1) == 0) {
|
581
|
+
} else if (GPR_UNLIKELY((t->incoming_stream_id & 1) == 0)) {
|
581
582
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
582
583
|
GPR_ERROR,
|
583
584
|
"ignoring grpc_chttp2_stream with non-client generated index %d",
|
584
585
|
t->incoming_stream_id));
|
585
586
|
return init_skip_frame_parser(t, 1);
|
586
|
-
} else if (
|
587
|
-
|
588
|
-
|
587
|
+
} else if (GPR_UNLIKELY(
|
588
|
+
grpc_chttp2_stream_map_size(&t->stream_map) >=
|
589
|
+
t->settings[GRPC_ACKED_SETTINGS]
|
590
|
+
[GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS])) {
|
589
591
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Max stream count exceeded");
|
590
592
|
}
|
591
593
|
t->last_new_stream_id = t->incoming_stream_id;
|
592
594
|
s = t->incoming_stream =
|
593
595
|
grpc_chttp2_parsing_accept_stream(t, t->incoming_stream_id);
|
594
|
-
if (s == nullptr) {
|
596
|
+
if (GPR_UNLIKELY(s == nullptr)) {
|
595
597
|
GRPC_CHTTP2_IF_TRACING(
|
596
598
|
gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
|
597
599
|
return init_skip_frame_parser(t, 1);
|
@@ -601,7 +603,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
|
|
601
603
|
}
|
602
604
|
GPR_ASSERT(s != nullptr);
|
603
605
|
s->stats.incoming.framing_bytes += 9;
|
604
|
-
if (s->read_closed) {
|
606
|
+
if (GPR_UNLIKELY(s->read_closed)) {
|
605
607
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
606
608
|
GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
|
607
609
|
t->incoming_stream = nullptr;
|
@@ -723,7 +725,7 @@ static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_slice slice,
|
|
723
725
|
int is_last) {
|
724
726
|
grpc_chttp2_stream* s = t->incoming_stream;
|
725
727
|
grpc_error* err = t->parser(t->parser_data, t, s, slice, is_last);
|
726
|
-
if (err == GRPC_ERROR_NONE) {
|
728
|
+
if (GPR_LIKELY(err == GRPC_ERROR_NONE)) {
|
727
729
|
return err;
|
728
730
|
} else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
|
729
731
|
if (grpc_http_trace.enabled()) {
|
@@ -337,10 +337,10 @@ class DataSendContext {
|
|
337
337
|
s_->fetching_send_message == nullptr);
|
338
338
|
if (is_last_data_frame && s_->send_trailing_metadata != nullptr &&
|
339
339
|
s_->stream_compression_ctx != nullptr) {
|
340
|
-
if (!grpc_stream_compress(
|
340
|
+
if (GPR_UNLIKELY(!grpc_stream_compress(
|
341
341
|
s_->stream_compression_ctx, &s_->flow_controlled_buffer,
|
342
342
|
&s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
|
343
|
-
GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
|
343
|
+
GRPC_STREAM_COMPRESSION_FLUSH_FINISH))) {
|
344
344
|
gpr_log(GPR_ERROR, "Stream compression failed.");
|
345
345
|
}
|
346
346
|
grpc_stream_compression_context_destroy(s_->stream_compression_ctx);
|
@@ -368,10 +368,10 @@ class DataSendContext {
|
|
368
368
|
grpc_stream_compression_context_create(s_->stream_compression_method);
|
369
369
|
}
|
370
370
|
s_->uncompressed_data_size = s_->flow_controlled_buffer.length;
|
371
|
-
if (!grpc_stream_compress(
|
372
|
-
|
373
|
-
|
374
|
-
|
371
|
+
if (GPR_UNLIKELY(!grpc_stream_compress(
|
372
|
+
s_->stream_compression_ctx, &s_->flow_controlled_buffer,
|
373
|
+
&s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
|
374
|
+
GRPC_STREAM_COMPRESSION_FLUSH_SYNC))) {
|
375
375
|
gpr_log(GPR_ERROR, "Stream compression failed.");
|
376
376
|
}
|
377
377
|
}
|
@@ -193,18 +193,13 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_call_stack* call_stack,
|
|
193
193
|
grpc_polling_entity* pollent) {
|
194
194
|
size_t count = call_stack->count;
|
195
195
|
grpc_call_element* call_elems;
|
196
|
-
char* user_data;
|
197
196
|
size_t i;
|
198
197
|
|
199
198
|
call_elems = CALL_ELEMS_FROM_STACK(call_stack);
|
200
|
-
user_data = (reinterpret_cast<char*>(call_elems)) +
|
201
|
-
ROUND_UP_TO_ALIGNMENT_SIZE(count * sizeof(grpc_call_element));
|
202
199
|
|
203
200
|
/* init per-filter data */
|
204
201
|
for (i = 0; i < count; i++) {
|
205
202
|
call_elems[i].filter->set_pollset_or_pollset_set(&call_elems[i], pollent);
|
206
|
-
user_data +=
|
207
|
-
ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
|
208
203
|
}
|
209
204
|
}
|
210
205
|
|
@@ -138,7 +138,7 @@ typedef struct {
|
|
138
138
|
is_first, is_last designate this elements position in the stack, and are
|
139
139
|
useful for asserting correct configuration by upper layer code.
|
140
140
|
The filter does not need to do any chaining.
|
141
|
-
Implementations may assume that elem->
|
141
|
+
Implementations may assume that elem->channel_data is all zeros. */
|
142
142
|
grpc_error* (*init_channel_elem)(grpc_channel_element* elem,
|
143
143
|
grpc_channel_element_args* args);
|
144
144
|
/* Destroy per channel data.
|
@@ -25,9 +25,6 @@
|
|
25
25
|
#include <grpc/support/alloc.h>
|
26
26
|
#include <grpc/support/string_util.h>
|
27
27
|
|
28
|
-
grpc_core::TraceFlag grpc_trace_channel_stack_builder(false,
|
29
|
-
"channel_stack_builder");
|
30
|
-
|
31
28
|
typedef struct filter_node {
|
32
29
|
struct filter_node* next;
|
33
30
|
struct filter_node* prev;
|
@@ -155,6 +155,4 @@ grpc_error* grpc_channel_stack_builder_finish(
|
|
155
155
|
/// Destroy the builder without creating a channel stack
|
156
156
|
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder* builder);
|
157
157
|
|
158
|
-
extern grpc_core::TraceFlag grpc_trace_channel_stack_builder;
|
159
|
-
|
160
158
|
#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */
|
@@ -28,7 +28,7 @@
|
|
28
28
|
#include <stdlib.h>
|
29
29
|
#include <string.h>
|
30
30
|
|
31
|
-
#include "src/core/lib/channel/
|
31
|
+
#include "src/core/lib/channel/channelz_registry.h"
|
32
32
|
#include "src/core/lib/channel/status_util.h"
|
33
33
|
#include "src/core/lib/gpr/string.h"
|
34
34
|
#include "src/core/lib/gpr/useful.h"
|
@@ -70,7 +70,7 @@ ChannelTrace::ChannelTrace(size_t max_events)
|
|
70
70
|
tail_trace_(nullptr) {
|
71
71
|
if (max_list_size_ == 0) return; // tracing is disabled if max_events == 0
|
72
72
|
gpr_mu_init(&tracer_mu_);
|
73
|
-
channel_uuid_ =
|
73
|
+
channel_uuid_ = ChannelzRegistry::Register(this);
|
74
74
|
time_created_ = grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
|
75
75
|
GPR_CLOCK_REALTIME);
|
76
76
|
}
|
@@ -83,7 +83,7 @@ ChannelTrace::~ChannelTrace() {
|
|
83
83
|
it = it->next();
|
84
84
|
Delete<TraceEvent>(to_free);
|
85
85
|
}
|
86
|
-
|
86
|
+
ChannelzRegistry::Unregister(channel_uuid_);
|
87
87
|
gpr_mu_destroy(&tracer_mu_);
|
88
88
|
}
|
89
89
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2017 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/impl/codegen/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/lib/channel/channel_trace.h"
|
22
|
+
#include "src/core/lib/channel/channelz_registry.h"
|
23
|
+
#include "src/core/lib/gpr/useful.h"
|
24
|
+
#include "src/core/lib/gprpp/memory.h"
|
25
|
+
|
26
|
+
#include <grpc/support/alloc.h>
|
27
|
+
#include <grpc/support/log.h>
|
28
|
+
|
29
|
+
namespace grpc_core {
|
30
|
+
namespace {
|
31
|
+
|
32
|
+
// singleton instance of the registry.
|
33
|
+
ChannelzRegistry* g_channelz_registry = nullptr;
|
34
|
+
|
35
|
+
// avl vtable for uuid (intptr_t) -> channelz_obj (void*)
|
36
|
+
// this table is only looking, it does not own anything.
|
37
|
+
void destroy_intptr(void* not_used, void* user_data) {}
|
38
|
+
void* copy_intptr(void* key, void* user_data) { return key; }
|
39
|
+
long compare_intptr(void* key1, void* key2, void* user_data) {
|
40
|
+
return GPR_ICMP(key1, key2);
|
41
|
+
}
|
42
|
+
|
43
|
+
void destroy_channelz_obj(void* channelz_obj, void* user_data) {}
|
44
|
+
void* copy_channelz_obj(void* channelz_obj, void* user_data) {
|
45
|
+
return channelz_obj;
|
46
|
+
}
|
47
|
+
const grpc_avl_vtable avl_vtable = {destroy_intptr, copy_intptr, compare_intptr,
|
48
|
+
destroy_channelz_obj, copy_channelz_obj};
|
49
|
+
|
50
|
+
} // anonymous namespace
|
51
|
+
|
52
|
+
void ChannelzRegistry::Init() { g_channelz_registry = New<ChannelzRegistry>(); }
|
53
|
+
|
54
|
+
void ChannelzRegistry::Shutdown() { Delete(g_channelz_registry); }
|
55
|
+
|
56
|
+
ChannelzRegistry* ChannelzRegistry::Default() {
|
57
|
+
GPR_DEBUG_ASSERT(g_channelz_registry != nullptr);
|
58
|
+
return g_channelz_registry;
|
59
|
+
}
|
60
|
+
|
61
|
+
ChannelzRegistry::ChannelzRegistry() : uuid_(1) {
|
62
|
+
gpr_mu_init(&mu_);
|
63
|
+
avl_ = grpc_avl_create(&avl_vtable);
|
64
|
+
}
|
65
|
+
|
66
|
+
ChannelzRegistry::~ChannelzRegistry() {
|
67
|
+
grpc_avl_unref(avl_, nullptr);
|
68
|
+
gpr_mu_destroy(&mu_);
|
69
|
+
}
|
70
|
+
|
71
|
+
void ChannelzRegistry::InternalUnregister(intptr_t uuid) {
|
72
|
+
gpr_mu_lock(&mu_);
|
73
|
+
avl_ = grpc_avl_remove(avl_, (void*)uuid, nullptr);
|
74
|
+
gpr_mu_unlock(&mu_);
|
75
|
+
}
|
76
|
+
|
77
|
+
} // namespace grpc_core
|