grpc 1.15.0 → 1.16.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 +158 -80
- data/etc/roots.pem +23 -0
- data/include/grpc/grpc.h +13 -1
- data/include/grpc/grpc_security.h +2 -2
- data/include/grpc/grpc_security_constants.h +24 -19
- data/include/grpc/impl/codegen/grpc_types.h +23 -5
- data/include/grpc/impl/codegen/port_platform.h +1 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +95 -10
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +71 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +45 -11
- data/src/core/ext/filters/client_channel/connector.h +3 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +12 -32
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -5
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +20 -15
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -4
- data/src/core/ext/filters/client_channel/parse_address.cc +27 -4
- data/src/core/ext/filters/client_channel/parse_address.h +3 -0
- data/src/core/ext/filters/client_channel/resolver.h +1 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -11
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +80 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +9 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +5 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +70 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -11
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -16
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +0 -7
- data/src/core/ext/filters/client_channel/subchannel.cc +45 -7
- data/src/core/ext/filters/client_channel/subchannel.h +16 -1
- data/src/core/ext/filters/client_channel/subchannel_index.cc +2 -1
- data/src/core/ext/filters/client_channel/subchannel_index.h +1 -4
- data/src/core/ext/filters/http/client/http_client_filter.cc +32 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +59 -1
- data/src/core/ext/filters/max_age/max_age_filter.cc +1 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +59 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +286 -228
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +14 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +29 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +9 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +10 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +85 -54
- data/src/core/ext/transport/chttp2/transport/writing.cc +6 -0
- data/src/core/lib/channel/channel_trace.cc +51 -56
- data/src/core/lib/channel/channel_trace.h +30 -25
- data/src/core/lib/channel/channelz.cc +235 -61
- data/src/core/lib/channel/channelz.h +179 -48
- data/src/core/lib/channel/channelz_registry.cc +95 -23
- data/src/core/lib/channel/channelz_registry.h +15 -42
- data/src/core/lib/gpr/sync_posix.cc +42 -0
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/iomgr/buffer_list.cc +134 -0
- data/src/core/lib/iomgr/buffer_list.h +96 -0
- data/src/core/lib/iomgr/endpoint.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +6 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +29 -18
- data/src/core/lib/iomgr/error.h +8 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_posix.cc +16 -10
- data/src/core/lib/iomgr/exec_ctx.h +0 -7
- data/src/core/lib/iomgr/{ev_epollsig_linux.h → internal_errqueue.cc} +13 -12
- data/src/core/lib/iomgr/internal_errqueue.h +83 -0
- data/src/core/lib/iomgr/port.h +11 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +90 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +306 -13
- data/src/core/lib/iomgr/tcp_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +4 -1
- data/src/core/lib/iomgr/tcp_windows.cc +1 -1
- data/src/core/lib/iomgr/timer_generic.cc +13 -12
- data/src/core/lib/iomgr/timer_heap.cc +2 -2
- data/src/core/lib/iomgr/timer_heap.h +3 -3
- data/src/core/lib/iomgr/timer_manager.cc +28 -3
- data/src/core/lib/iomgr/timer_manager.h +2 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -1
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +2 -1
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +2 -1
- data/src/core/lib/security/security_connector/security_connector.cc +7 -7
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +1 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +53 -4
- data/src/core/lib/slice/slice.cc +8 -0
- data/src/core/lib/slice/slice_internal.h +5 -0
- data/src/core/lib/surface/call.cc +149 -253
- data/src/core/lib/surface/call.h +1 -0
- data/src/core/lib/surface/channel.cc +17 -13
- data/src/core/lib/surface/completion_queue.cc +21 -17
- data/src/core/lib/surface/completion_queue.h +1 -18
- data/src/core/lib/surface/completion_queue_factory.cc +3 -3
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/server.cc +77 -4
- data/src/core/lib/surface/server.h +4 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +0 -18
- data/src/core/lib/transport/metadata.h +0 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -2
- data/src/core/lib/transport/metadata_batch.h +2 -0
- data/src/core/lib/transport/static_metadata.cc +220 -249
- data/src/core/lib/transport/static_metadata.h +189 -191
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +5 -4
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +3 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +4 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +6 -5
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +2 -2
- data/src/core/tsi/alts_transport_security.cc +3 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +2 -1
- data/src/ruby/ext/grpc/rb_call.c +1 -0
- data/src/ruby/ext/grpc/rb_channel.c +3 -0
- data/src/ruby/ext/grpc/rb_grpc.c +31 -1
- data/src/ruby/ext/grpc/rb_grpc.h +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +12 -3
- data/src/ruby/ext/grpc/rb_server.c +2 -0
- data/src/ruby/lib/grpc/errors.rb +0 -1
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +3 -3
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +44 -0
- data/src/ruby/spec/client_auth_spec.rb +5 -5
- data/src/ruby/spec/generic/client_stub_spec.rb +13 -9
- data/src/ruby/spec/generic/rpc_server_spec.rb +3 -3
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +53 -0
- data/src/ruby/spec/support/services.rb +28 -22
- metadata +35 -31
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +0 -1743
data/etc/roots.pem
CHANGED
@@ -4317,3 +4317,26 @@ JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R
|
|
4317
4317
|
8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4
|
4318
4318
|
5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
|
4319
4319
|
-----END CERTIFICATE-----
|
4320
|
+
|
4321
|
+
# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed
|
4322
|
+
# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed
|
4323
|
+
# Label: "OISTE WISeKey Global Root GC CA"
|
4324
|
+
# Serial: 44084345621038548146064804565436152554
|
4325
|
+
# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23
|
4326
|
+
# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31
|
4327
|
+
# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d
|
4328
|
+
-----BEGIN CERTIFICATE-----
|
4329
|
+
MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw
|
4330
|
+
CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91
|
4331
|
+
bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg
|
4332
|
+
Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ
|
4333
|
+
BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu
|
4334
|
+
ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS
|
4335
|
+
b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni
|
4336
|
+
eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W
|
4337
|
+
p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E
|
4338
|
+
BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T
|
4339
|
+
rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV
|
4340
|
+
57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg
|
4341
|
+
Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
|
4342
|
+
-----END CERTIFICATE-----
|
data/include/grpc/grpc.h
CHANGED
@@ -111,7 +111,8 @@ GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_pluck(
|
|
111
111
|
of GRPC_CQ_CALLBACK and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING.
|
112
112
|
This function is experimental. */
|
113
113
|
GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_callback(
|
114
|
-
|
114
|
+
grpc_experimental_completion_queue_functor* shutdown_callback,
|
115
|
+
void* reserved);
|
115
116
|
|
116
117
|
/** Create a completion queue */
|
117
118
|
GRPCAPI grpc_completion_queue* grpc_completion_queue_create(
|
@@ -499,10 +500,21 @@ GRPCAPI const grpc_arg_pointer_vtable* grpc_resource_quota_arg_vtable(void);
|
|
499
500
|
The returned string is allocated and must be freed by the application. */
|
500
501
|
GRPCAPI char* grpc_channelz_get_top_channels(intptr_t start_channel_id);
|
501
502
|
|
503
|
+
/* Gets all servers that exist in the process. */
|
504
|
+
GRPCAPI char* grpc_channelz_get_servers(intptr_t start_server_id);
|
505
|
+
|
502
506
|
/* Returns a single Channel, or else a NOT_FOUND code. The returned string
|
503
507
|
is allocated and must be freed by the application. */
|
504
508
|
GRPCAPI char* grpc_channelz_get_channel(intptr_t channel_id);
|
505
509
|
|
510
|
+
/* Returns a single Subchannel, or else a NOT_FOUND code. The returned string
|
511
|
+
is allocated and must be freed by the application. */
|
512
|
+
GRPCAPI char* grpc_channelz_get_subchannel(intptr_t subchannel_id);
|
513
|
+
|
514
|
+
/* Returns a single Socket, or else a NOT_FOUND code. The returned string
|
515
|
+
is allocated and must be freed by the application. */
|
516
|
+
GRPCAPI char* grpc_channelz_get_socket(intptr_t socket_id);
|
517
|
+
|
506
518
|
#ifdef __cplusplus
|
507
519
|
}
|
508
520
|
#endif
|
@@ -532,14 +532,14 @@ typedef struct grpc_alts_credentials_options grpc_alts_credentials_options;
|
|
532
532
|
* It is used for experimental purpose for now and subject to change.
|
533
533
|
*/
|
534
534
|
GRPCAPI grpc_alts_credentials_options*
|
535
|
-
grpc_alts_credentials_client_options_create();
|
535
|
+
grpc_alts_credentials_client_options_create(void);
|
536
536
|
|
537
537
|
/**
|
538
538
|
* This method creates a grpc ALTS credentials server options instance.
|
539
539
|
* It is used for experimental purpose for now and subject to change.
|
540
540
|
*/
|
541
541
|
GRPCAPI grpc_alts_credentials_options*
|
542
|
-
grpc_alts_credentials_server_options_create();
|
542
|
+
grpc_alts_credentials_server_options_create(void);
|
543
543
|
|
544
544
|
/**
|
545
545
|
* This method adds a target service account to grpc client's ALTS credentials
|
@@ -57,46 +57,51 @@ typedef enum {
|
|
57
57
|
} grpc_ssl_certificate_config_reload_status;
|
58
58
|
|
59
59
|
typedef enum {
|
60
|
-
/** Server does not request client certificate.
|
61
|
-
|
62
|
-
|
60
|
+
/** Server does not request client certificate.
|
61
|
+
The certificate presented by the client is not checked by the server at
|
62
|
+
all. (A client may present a self signed or signed certificate or not
|
63
|
+
present a certificate at all and any of those option would be accepted) */
|
63
64
|
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
|
64
65
|
/** Server requests client certificate but does not enforce that the client
|
65
66
|
presents a certificate.
|
66
67
|
|
67
68
|
If the client presents a certificate, the client authentication is left to
|
68
|
-
the application
|
69
|
+
the application (the necessary metadata will be available to the
|
70
|
+
application via authentication context properties, see grpc_auth_context).
|
69
71
|
|
70
|
-
The key
|
71
|
-
established. */
|
72
|
+
The client's key certificate pair must be valid for the SSL connection to
|
73
|
+
be established. */
|
72
74
|
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
|
73
75
|
/** Server requests client certificate but does not enforce that the client
|
74
76
|
presents a certificate.
|
75
77
|
|
76
78
|
If the client presents a certificate, the client authentication is done by
|
77
|
-
|
78
|
-
certificate
|
79
|
+
the gRPC framework. (For a successful connection the client needs to either
|
80
|
+
present a certificate that can be verified against the root certificate
|
81
|
+
configured by the server or not present a certificate at all)
|
79
82
|
|
80
|
-
The key
|
81
|
-
established. */
|
83
|
+
The client's key certificate pair must be valid for the SSL connection to
|
84
|
+
be established. */
|
82
85
|
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY,
|
83
|
-
/** Server requests client certificate
|
86
|
+
/** Server requests client certificate and enforces that the client presents a
|
84
87
|
certificate.
|
85
88
|
|
86
89
|
If the client presents a certificate, the client authentication is left to
|
87
|
-
the application
|
90
|
+
the application (the necessary metadata will be available to the
|
91
|
+
application via authentication context properties, see grpc_auth_context).
|
88
92
|
|
89
|
-
The key
|
90
|
-
established. */
|
93
|
+
The client's key certificate pair must be valid for the SSL connection to
|
94
|
+
be established. */
|
91
95
|
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
|
92
|
-
/** Server requests client certificate
|
96
|
+
/** Server requests client certificate and enforces that the client presents a
|
93
97
|
certificate.
|
94
98
|
|
95
|
-
The cerificate presented by the client is verified by
|
96
|
-
client needs to present
|
99
|
+
The cerificate presented by the client is verified by the gRPC framework.
|
100
|
+
(For a successful connection the client needs to present a certificate that
|
101
|
+
can be verified against the root certificate configured by the server)
|
97
102
|
|
98
|
-
The key
|
99
|
-
established. */
|
103
|
+
The client's key certificate pair must be valid for the SSL connection to
|
104
|
+
be established. */
|
100
105
|
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
|
101
106
|
} grpc_ssl_client_certificate_request_type;
|
102
107
|
|
@@ -285,10 +285,12 @@ typedef struct {
|
|
285
285
|
#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
|
286
286
|
/** The grpc_socket_factory instance to create and bind sockets. A pointer. */
|
287
287
|
#define GRPC_ARG_SOCKET_FACTORY "grpc.socket_factory"
|
288
|
-
/** The maximum
|
289
|
-
*
|
290
|
-
|
291
|
-
|
288
|
+
/** The maximum amount of memory used by trace events per channel trace node.
|
289
|
+
* Once the maximum is reached, subsequent events will evict the oldest events
|
290
|
+
* from the buffer. The unit for this knob is bytes. Setting it to zero causes
|
291
|
+
* channel tracing to be disabled. */
|
292
|
+
#define GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE \
|
293
|
+
"grpc.max_channel_trace_event_memory_per_node"
|
292
294
|
/** If non-zero, gRPC library will track stats and information at at per channel
|
293
295
|
* level. Disabling channelz naturally disables channel tracing. The default
|
294
296
|
* is for channelz to be disabled. */
|
@@ -342,6 +344,9 @@ typedef struct {
|
|
342
344
|
"grpc.disable_client_authority_filter"
|
343
345
|
/** If set to zero, disables use of http proxies. Enabled by default. */
|
344
346
|
#define GRPC_ARG_ENABLE_HTTP_PROXY "grpc.enable_http_proxy"
|
347
|
+
/** If set to non zero, surfaces the user agent string to the server. User
|
348
|
+
agent is surfaced by default. */
|
349
|
+
#define GRPC_ARG_SURFACE_USER_AGENT "grpc.surface_user_agent"
|
345
350
|
/** \} */
|
346
351
|
|
347
352
|
/** Result of a grpc call. If the caller satisfies the prerequisites of a
|
@@ -657,6 +662,19 @@ typedef enum {
|
|
657
662
|
GRPC_CQ_CALLBACK
|
658
663
|
} grpc_cq_completion_type;
|
659
664
|
|
665
|
+
/** EXPERIMENTAL: Specifies an interface class to be used as a tag
|
666
|
+
for callback-based completion queues. This can be used directly,
|
667
|
+
as the first element of a struct in C, or as a base class in C++.
|
668
|
+
Its "run" value should be assigned to some non-member function, such as
|
669
|
+
a static method. */
|
670
|
+
typedef struct grpc_experimental_completion_queue_functor {
|
671
|
+
/** The run member specifies a function that will be called when this
|
672
|
+
tag is extracted from the completion queue. Its arguments will be a
|
673
|
+
pointer to this functor and a boolean that indicates whether the
|
674
|
+
operation succeeded (non-zero) or failed (zero) */
|
675
|
+
void (*functor_run)(struct grpc_experimental_completion_queue_functor*, int);
|
676
|
+
} grpc_experimental_completion_queue_functor;
|
677
|
+
|
660
678
|
/* The upgrade to version 2 is currently experimental. */
|
661
679
|
|
662
680
|
#define GRPC_CQ_CURRENT_VERSION 2
|
@@ -675,7 +693,7 @@ typedef struct grpc_completion_queue_attributes {
|
|
675
693
|
/* EXPERIMENTAL: START OF VERSION 2 CQ ATTRIBUTES */
|
676
694
|
/** When creating a callbackable CQ, pass in a functor to get invoked when
|
677
695
|
* shutdown is complete */
|
678
|
-
|
696
|
+
grpc_experimental_completion_queue_functor* cq_shutdown_cb;
|
679
697
|
|
680
698
|
/* END OF VERSION 2 CQ ATTRIBUTES */
|
681
699
|
} grpc_completion_queue_attributes;
|
@@ -457,7 +457,6 @@ get_service_config_from_resolver_result_locked(channel_data* chand) {
|
|
457
457
|
grpc_uri* uri = grpc_uri_parse(server_uri, true);
|
458
458
|
GPR_ASSERT(uri->path[0] != '\0');
|
459
459
|
service_config_parsing_state parsing_state;
|
460
|
-
memset(&parsing_state, 0, sizeof(parsing_state));
|
461
460
|
parsing_state.server_name =
|
462
461
|
uri->path[0] == '/' ? uri->path + 1 : uri->path;
|
463
462
|
service_config->ParseGlobalParams(parse_retry_throttle_params,
|
@@ -934,6 +933,11 @@ typedef struct client_channel_call_data {
|
|
934
933
|
grpc_closure pick_closure;
|
935
934
|
grpc_closure pick_cancel_closure;
|
936
935
|
|
936
|
+
// state needed to support channelz interception of recv trailing metadata.
|
937
|
+
grpc_closure recv_trailing_metadata_ready_channelz;
|
938
|
+
grpc_closure* original_recv_trailing_metadata;
|
939
|
+
grpc_metadata_batch* recv_trailing_metadata;
|
940
|
+
|
937
941
|
grpc_polling_entity* pollent;
|
938
942
|
bool pollent_added_to_interested_parties;
|
939
943
|
|
@@ -995,6 +999,8 @@ static void start_internal_recv_trailing_metadata(grpc_call_element* elem);
|
|
995
999
|
static void on_complete(void* arg, grpc_error* error);
|
996
1000
|
static void start_retriable_subchannel_batches(void* arg, grpc_error* ignored);
|
997
1001
|
static void start_pick_locked(void* arg, grpc_error* ignored);
|
1002
|
+
static void maybe_intercept_recv_trailing_metadata_for_channelz(
|
1003
|
+
grpc_call_element* elem, grpc_transport_stream_op_batch* batch);
|
998
1004
|
|
999
1005
|
//
|
1000
1006
|
// send op data caching
|
@@ -1293,6 +1299,7 @@ static void pending_batches_resume(grpc_call_element* elem) {
|
|
1293
1299
|
pending_batch* pending = &calld->pending_batches[i];
|
1294
1300
|
grpc_transport_stream_op_batch* batch = pending->batch;
|
1295
1301
|
if (batch != nullptr) {
|
1302
|
+
maybe_intercept_recv_trailing_metadata_for_channelz(elem, batch);
|
1296
1303
|
batch->handler_private.extra_arg = calld->subchannel_call;
|
1297
1304
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
1298
1305
|
resume_pending_batch_in_call_combiner, batch,
|
@@ -1778,23 +1785,22 @@ static void recv_message_ready(void* arg, grpc_error* error) {
|
|
1778
1785
|
// recv_trailing_metadata handling
|
1779
1786
|
//
|
1780
1787
|
|
1781
|
-
// Sets *status and *server_pushback_md based on
|
1782
|
-
|
1783
|
-
|
1788
|
+
// Sets *status and *server_pushback_md based on md_batch and error.
|
1789
|
+
// Only sets *server_pushback_md if server_pushback_md != nullptr.
|
1790
|
+
static void get_call_status(grpc_call_element* elem,
|
1791
|
+
grpc_metadata_batch* md_batch, grpc_error* error,
|
1792
|
+
grpc_status_code* status,
|
1784
1793
|
grpc_mdelem** server_pushback_md) {
|
1785
|
-
grpc_call_element* elem = batch_data->elem;
|
1786
1794
|
call_data* calld = static_cast<call_data*>(elem->call_data);
|
1787
1795
|
if (error != GRPC_ERROR_NONE) {
|
1788
1796
|
grpc_error_get_status(error, calld->deadline, status, nullptr, nullptr,
|
1789
1797
|
nullptr);
|
1790
1798
|
} else {
|
1791
|
-
grpc_metadata_batch* md_batch =
|
1792
|
-
batch_data->batch.payload->recv_trailing_metadata
|
1793
|
-
.recv_trailing_metadata;
|
1794
1799
|
GPR_ASSERT(md_batch->idx.named.grpc_status != nullptr);
|
1795
1800
|
*status =
|
1796
1801
|
grpc_get_status_code_from_metadata(md_batch->idx.named.grpc_status->md);
|
1797
|
-
if (
|
1802
|
+
if (server_pushback_md != nullptr &&
|
1803
|
+
md_batch->idx.named.grpc_retry_pushback_ms != nullptr) {
|
1798
1804
|
*server_pushback_md = &md_batch->idx.named.grpc_retry_pushback_ms->md;
|
1799
1805
|
}
|
1800
1806
|
}
|
@@ -1967,8 +1973,19 @@ static void recv_trailing_metadata_ready(void* arg, grpc_error* error) {
|
|
1967
1973
|
// Get the call's status and check for server pushback metadata.
|
1968
1974
|
grpc_status_code status = GRPC_STATUS_OK;
|
1969
1975
|
grpc_mdelem* server_pushback_md = nullptr;
|
1970
|
-
|
1976
|
+
grpc_metadata_batch* md_batch =
|
1977
|
+
batch_data->batch.payload->recv_trailing_metadata.recv_trailing_metadata;
|
1978
|
+
get_call_status(elem, md_batch, GRPC_ERROR_REF(error), &status,
|
1971
1979
|
&server_pushback_md);
|
1980
|
+
grpc_core::channelz::SubchannelNode* channelz_subchannel =
|
1981
|
+
calld->pick.connected_subchannel->channelz_subchannel();
|
1982
|
+
if (channelz_subchannel != nullptr) {
|
1983
|
+
if (status == GRPC_STATUS_OK) {
|
1984
|
+
channelz_subchannel->RecordCallSucceeded();
|
1985
|
+
} else {
|
1986
|
+
channelz_subchannel->RecordCallFailed();
|
1987
|
+
}
|
1988
|
+
}
|
1972
1989
|
if (grpc_client_channel_trace.enabled()) {
|
1973
1990
|
gpr_log(GPR_INFO, "chand=%p calld=%p: call finished, status=%s", chand,
|
1974
1991
|
calld, grpc_status_code_to_string(status));
|
@@ -2572,6 +2589,69 @@ static void start_retriable_subchannel_batches(void* arg, grpc_error* ignored) {
|
|
2572
2589
|
closures.RunClosures(calld->call_combiner);
|
2573
2590
|
}
|
2574
2591
|
|
2592
|
+
//
|
2593
|
+
// Channelz
|
2594
|
+
//
|
2595
|
+
|
2596
|
+
static void recv_trailing_metadata_ready_channelz(void* arg,
|
2597
|
+
grpc_error* error) {
|
2598
|
+
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
2599
|
+
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
2600
|
+
call_data* calld = static_cast<call_data*>(elem->call_data);
|
2601
|
+
if (grpc_client_channel_trace.enabled()) {
|
2602
|
+
gpr_log(GPR_INFO,
|
2603
|
+
"chand=%p calld=%p: got recv_trailing_metadata_ready_channelz, "
|
2604
|
+
"error=%s",
|
2605
|
+
chand, calld, grpc_error_string(error));
|
2606
|
+
}
|
2607
|
+
GPR_ASSERT(calld->recv_trailing_metadata != nullptr);
|
2608
|
+
grpc_status_code status = GRPC_STATUS_OK;
|
2609
|
+
grpc_metadata_batch* md_batch = calld->recv_trailing_metadata;
|
2610
|
+
get_call_status(elem, md_batch, GRPC_ERROR_REF(error), &status, nullptr);
|
2611
|
+
grpc_core::channelz::SubchannelNode* channelz_subchannel =
|
2612
|
+
calld->pick.connected_subchannel->channelz_subchannel();
|
2613
|
+
GPR_ASSERT(channelz_subchannel != nullptr);
|
2614
|
+
if (status == GRPC_STATUS_OK) {
|
2615
|
+
channelz_subchannel->RecordCallSucceeded();
|
2616
|
+
} else {
|
2617
|
+
channelz_subchannel->RecordCallFailed();
|
2618
|
+
}
|
2619
|
+
calld->recv_trailing_metadata = nullptr;
|
2620
|
+
GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata, error);
|
2621
|
+
}
|
2622
|
+
|
2623
|
+
// If channelz is enabled, intercept recv_trailing so that we may check the
|
2624
|
+
// status and associate it to a subchannel.
|
2625
|
+
// Returns true if callback was intercepted, false otherwise.
|
2626
|
+
static void maybe_intercept_recv_trailing_metadata_for_channelz(
|
2627
|
+
grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
|
2628
|
+
call_data* calld = static_cast<call_data*>(elem->call_data);
|
2629
|
+
// only intercept payloads with recv trailing.
|
2630
|
+
if (!batch->recv_trailing_metadata) {
|
2631
|
+
return;
|
2632
|
+
}
|
2633
|
+
// only add interceptor is channelz is enabled.
|
2634
|
+
if (calld->pick.connected_subchannel->channelz_subchannel() == nullptr) {
|
2635
|
+
return;
|
2636
|
+
}
|
2637
|
+
if (grpc_client_channel_trace.enabled()) {
|
2638
|
+
gpr_log(GPR_INFO,
|
2639
|
+
"calld=%p batch=%p: intercepting recv trailing for channelz", calld,
|
2640
|
+
batch);
|
2641
|
+
}
|
2642
|
+
GRPC_CLOSURE_INIT(&calld->recv_trailing_metadata_ready_channelz,
|
2643
|
+
recv_trailing_metadata_ready_channelz, elem,
|
2644
|
+
grpc_schedule_on_exec_ctx);
|
2645
|
+
// save some state needed for the interception callback.
|
2646
|
+
GPR_ASSERT(calld->recv_trailing_metadata == nullptr);
|
2647
|
+
calld->recv_trailing_metadata =
|
2648
|
+
batch->payload->recv_trailing_metadata.recv_trailing_metadata;
|
2649
|
+
calld->original_recv_trailing_metadata =
|
2650
|
+
batch->payload->recv_trailing_metadata.recv_trailing_metadata_ready;
|
2651
|
+
batch->payload->recv_trailing_metadata.recv_trailing_metadata_ready =
|
2652
|
+
&calld->recv_trailing_metadata_ready_channelz;
|
2653
|
+
}
|
2654
|
+
|
2575
2655
|
//
|
2576
2656
|
// LB pick
|
2577
2657
|
//
|
@@ -2601,6 +2681,11 @@ static void create_subchannel_call(grpc_call_element* elem, grpc_error* error) {
|
|
2601
2681
|
new_error = grpc_error_add_child(new_error, error);
|
2602
2682
|
pending_batches_fail(elem, new_error, true /* yield_call_combiner */);
|
2603
2683
|
} else {
|
2684
|
+
grpc_core::channelz::SubchannelNode* channelz_subchannel =
|
2685
|
+
calld->pick.connected_subchannel->channelz_subchannel();
|
2686
|
+
if (channelz_subchannel != nullptr) {
|
2687
|
+
channelz_subchannel->RecordCallStarted();
|
2688
|
+
}
|
2604
2689
|
if (parent_data_size > 0) {
|
2605
2690
|
subchannel_call_retry_state* retry_state =
|
2606
2691
|
static_cast<subchannel_call_retry_state*>(
|
@@ -20,10 +20,13 @@
|
|
20
20
|
|
21
21
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
22
22
|
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
23
|
+
#include "src/core/lib/channel/channelz_registry.h"
|
23
24
|
#include "src/core/lib/gpr/useful.h"
|
24
25
|
#include "src/core/lib/surface/channel.h"
|
25
26
|
#include "src/core/lib/transport/connectivity_state.h"
|
26
27
|
|
28
|
+
#include <grpc/support/string_util.h>
|
29
|
+
|
27
30
|
namespace grpc_core {
|
28
31
|
namespace channelz {
|
29
32
|
namespace {
|
@@ -109,5 +112,73 @@ RefCountedPtr<ChannelNode> ClientChannelNode::MakeClientChannelNode(
|
|
109
112
|
is_top_level_channel);
|
110
113
|
}
|
111
114
|
|
115
|
+
SubchannelNode::SubchannelNode(grpc_subchannel* subchannel,
|
116
|
+
size_t channel_tracer_max_nodes)
|
117
|
+
: BaseNode(EntityType::kSubchannel),
|
118
|
+
subchannel_(subchannel),
|
119
|
+
target_(
|
120
|
+
UniquePtr<char>(gpr_strdup(grpc_subchannel_get_target(subchannel_)))),
|
121
|
+
trace_(channel_tracer_max_nodes) {}
|
122
|
+
|
123
|
+
SubchannelNode::~SubchannelNode() {}
|
124
|
+
|
125
|
+
void SubchannelNode::PopulateConnectivityState(grpc_json* json) {
|
126
|
+
grpc_connectivity_state state;
|
127
|
+
if (subchannel_ == nullptr) {
|
128
|
+
state = GRPC_CHANNEL_SHUTDOWN;
|
129
|
+
} else {
|
130
|
+
state = grpc_subchannel_check_connectivity(subchannel_, nullptr);
|
131
|
+
}
|
132
|
+
json = grpc_json_create_child(nullptr, json, "state", nullptr,
|
133
|
+
GRPC_JSON_OBJECT, false);
|
134
|
+
grpc_json_create_child(nullptr, json, "state",
|
135
|
+
grpc_connectivity_state_name(state), GRPC_JSON_STRING,
|
136
|
+
false);
|
137
|
+
}
|
138
|
+
|
139
|
+
grpc_json* SubchannelNode::RenderJson() {
|
140
|
+
grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT);
|
141
|
+
grpc_json* json = top_level_json;
|
142
|
+
grpc_json* json_iterator = nullptr;
|
143
|
+
json_iterator = grpc_json_create_child(json_iterator, json, "ref", nullptr,
|
144
|
+
GRPC_JSON_OBJECT, false);
|
145
|
+
json = json_iterator;
|
146
|
+
json_iterator = nullptr;
|
147
|
+
json_iterator = grpc_json_add_number_string_child(json, json_iterator,
|
148
|
+
"subchannelId", uuid());
|
149
|
+
// reset json iterators to top level object
|
150
|
+
json = top_level_json;
|
151
|
+
json_iterator = nullptr;
|
152
|
+
// create and fill the data child.
|
153
|
+
grpc_json* data = grpc_json_create_child(json_iterator, json, "data", nullptr,
|
154
|
+
GRPC_JSON_OBJECT, false);
|
155
|
+
json = data;
|
156
|
+
json_iterator = nullptr;
|
157
|
+
PopulateConnectivityState(json);
|
158
|
+
GPR_ASSERT(target_.get() != nullptr);
|
159
|
+
grpc_json_create_child(nullptr, json, "target", target_.get(),
|
160
|
+
GRPC_JSON_STRING, false);
|
161
|
+
// fill in the channel trace if applicable
|
162
|
+
grpc_json* trace_json = trace_.RenderJson();
|
163
|
+
if (trace_json != nullptr) {
|
164
|
+
trace_json->key = "trace"; // this object is named trace in channelz.proto
|
165
|
+
grpc_json_link_child(json, trace_json, nullptr);
|
166
|
+
}
|
167
|
+
// ask CallCountingHelper to populate trace and call count data.
|
168
|
+
call_counter_.PopulateCallCounts(json);
|
169
|
+
json = top_level_json;
|
170
|
+
// populate the child socket.
|
171
|
+
intptr_t socket_uuid = grpc_subchannel_get_child_socket_uuid(subchannel_);
|
172
|
+
if (socket_uuid != 0) {
|
173
|
+
grpc_json* array_parent = grpc_json_create_child(
|
174
|
+
nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false);
|
175
|
+
json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr,
|
176
|
+
nullptr, GRPC_JSON_OBJECT, false);
|
177
|
+
grpc_json_add_number_string_child(json_iterator, nullptr, "socketId",
|
178
|
+
socket_uuid);
|
179
|
+
}
|
180
|
+
return top_level_json;
|
181
|
+
}
|
182
|
+
|
112
183
|
} // namespace channelz
|
113
184
|
} // namespace grpc_core
|