grpc 0.14.1 → 0.15.0
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 +1398 -817
- data/include/grpc/compression.h +2 -1
- data/include/grpc/grpc.h +10 -1
- data/include/grpc/grpc_cronet.h +51 -0
- data/include/grpc/grpc_posix.h +70 -0
- data/include/grpc/impl/codegen/atm.h +2 -2
- data/include/grpc/impl/codegen/{atm_win32.h → atm_windows.h} +3 -3
- data/include/grpc/impl/codegen/compression_types.h +39 -5
- data/include/grpc/impl/codegen/connectivity_state.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +10 -0
- data/include/grpc/impl/codegen/log.h +2 -1
- data/include/grpc/impl/codegen/port_platform.h +30 -12
- data/include/grpc/impl/codegen/slice_buffer.h +2 -3
- data/include/grpc/impl/codegen/sync.h +2 -2
- data/include/grpc/impl/codegen/{sync_win32.h → sync_windows.h} +3 -3
- data/include/grpc/support/{sync_win32.h → atm_windows.h} +4 -4
- data/include/grpc/support/avl.h +5 -0
- data/include/grpc/support/{log_win32.h → log_windows.h} +3 -3
- data/include/grpc/support/string_util.h +2 -1
- data/include/grpc/support/{atm_win32.h → sync_windows.h} +4 -4
- data/src/core/ext/census/gen/census.pb.c +179 -0
- data/src/core/ext/census/gen/census.pb.h +294 -0
- data/src/core/ext/census/grpc_filter.c +11 -7
- data/src/core/ext/client_config/channel_connectivity.c +28 -14
- data/src/core/ext/client_config/client_channel.c +77 -53
- data/src/core/ext/client_config/connector.h +1 -1
- data/src/core/ext/client_config/lb_policy.c +9 -6
- data/src/core/ext/client_config/lb_policy.h +9 -5
- data/src/core/ext/client_config/subchannel.c +58 -39
- data/src/core/ext/client_config/subchannel.h +3 -2
- data/src/core/ext/client_config/subchannel_call_holder.c +34 -19
- data/src/core/ext/client_config/subchannel_call_holder.h +2 -1
- data/src/core/ext/client_config/subchannel_index.c +20 -9
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +7 -7
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +5 -5
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/{v0 → v1}/load_balancer.pb.c +29 -30
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +178 -0
- data/src/core/ext/lb_policy/pick_first/pick_first.c +65 -45
- data/src/core/ext/lb_policy/round_robin/round_robin.c +84 -43
- data/src/core/ext/load_reporting/load_reporting.c +133 -0
- data/src/core/ext/load_reporting/load_reporting.h +75 -0
- data/src/core/ext/load_reporting/load_reporting_filter.c +151 -0
- data/src/core/ext/load_reporting/load_reporting_filter.h +41 -0
- data/src/core/ext/resolver/dns/native/dns_resolver.c +22 -8
- data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +2 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +4 -4
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +14 -18
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +49 -24
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +82 -0
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +104 -60
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +232 -0
- data/src/{ruby/ext/grpc/rb_signal.c → core/ext/transport/chttp2/transport/bin_decoder.h} +27 -31
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +481 -260
- data/src/core/ext/transport/chttp2/transport/frame.h +1 -7
- data/src/core/ext/transport/chttp2/transport/frame_data.c +44 -27
- data/src/core/ext/transport/chttp2/transport/frame_data.h +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +23 -17
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +12 -7
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +25 -12
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +23 -21
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -9
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +365 -287
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -6
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -20
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -4
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +1 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +34 -32
- data/src/core/ext/transport/chttp2/transport/parsing.c +296 -212
- data/src/core/ext/transport/chttp2/transport/writing.c +12 -9
- data/src/core/lib/channel/channel_args.c +26 -12
- data/src/core/lib/channel/channel_args.h +1 -1
- data/src/core/lib/channel/channel_stack.c +12 -8
- data/src/core/lib/channel/channel_stack.h +27 -11
- data/src/core/lib/channel/channel_stack_builder.c +2 -2
- data/src/core/lib/channel/compress_filter.c +26 -31
- data/src/core/lib/channel/compress_filter.h +4 -4
- data/src/core/lib/channel/connected_channel.c +7 -5
- data/src/core/lib/channel/http_client_filter.c +34 -8
- data/src/core/lib/channel/http_client_filter.h +1 -1
- data/src/core/lib/channel/http_server_filter.c +21 -12
- data/src/core/lib/compression/{compression_algorithm.c → compression.c} +22 -21
- data/src/core/lib/http/httpcli.c +81 -59
- data/src/core/lib/http/httpcli.h +11 -15
- data/src/core/lib/http/httpcli_security_connector.c +5 -3
- data/src/core/lib/http/parser.c +127 -118
- data/src/core/lib/http/parser.h +11 -6
- data/src/core/lib/iomgr/closure.c +20 -16
- data/src/core/lib/iomgr/closure.h +19 -15
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.c +2 -2
- data/src/core/lib/iomgr/error.c +535 -0
- data/src/core/lib/iomgr/error.h +192 -0
- data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +190 -83
- data/src/core/lib/iomgr/ev_poll_posix.c +1267 -0
- data/src/{ruby/ext/grpc/rb_signal.h → core/lib/iomgr/ev_poll_posix.h} +7 -5
- data/src/core/lib/iomgr/ev_posix.c +104 -14
- data/src/core/lib/iomgr/ev_posix.h +17 -7
- data/src/core/lib/iomgr/exec_ctx.c +25 -7
- data/src/core/lib/iomgr/exec_ctx.h +27 -8
- data/src/core/lib/iomgr/executor.c +2 -2
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.c +2 -41
- data/src/core/lib/iomgr/iocp_windows.h +0 -8
- data/src/core/lib/iomgr/iomgr.c +5 -4
- data/src/core/lib/iomgr/iomgr_posix.c +5 -1
- data/src/core/lib/iomgr/iomgr_windows.c +1 -1
- data/src/core/lib/{support → iomgr}/load_file.c +15 -17
- data/src/core/lib/{support → iomgr}/load_file.h +8 -7
- data/src/core/lib/iomgr/polling_entity.c +104 -0
- data/src/core/lib/iomgr/polling_entity.h +81 -0
- data/src/core/lib/iomgr/pollset.h +6 -5
- data/src/core/lib/iomgr/pollset_set_windows.c +4 -1
- data/src/core/lib/iomgr/pollset_windows.c +10 -6
- data/src/core/lib/iomgr/resolve_address.h +5 -9
- data/src/core/lib/iomgr/resolve_address_posix.c +55 -38
- data/src/core/lib/iomgr/resolve_address_windows.c +51 -37
- data/src/core/lib/iomgr/sockaddr.h +2 -2
- data/src/core/lib/iomgr/{sockaddr_win32.h → sockaddr_windows.h} +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.c +92 -45
- data/src/core/lib/iomgr/socket_utils_posix.h +19 -12
- data/src/core/lib/iomgr/socket_windows.c +61 -2
- data/src/core/lib/iomgr/socket_windows.h +13 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +54 -39
- data/src/core/lib/iomgr/tcp_client_windows.c +34 -34
- data/src/core/lib/iomgr/tcp_posix.c +43 -39
- data/src/core/lib/iomgr/tcp_server.h +5 -3
- data/src/core/lib/iomgr/tcp_server_posix.c +103 -64
- data/src/core/lib/iomgr/tcp_server_windows.c +114 -101
- data/src/core/lib/iomgr/tcp_windows.c +45 -50
- data/src/core/lib/iomgr/tcp_windows.h +1 -1
- data/src/core/lib/iomgr/timer.c +26 -13
- data/src/core/lib/iomgr/udp_server.c +28 -4
- data/src/core/lib/iomgr/udp_server.h +5 -1
- data/src/core/lib/iomgr/unix_sockets_posix.c +8 -7
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +15 -5
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +13 -9
- data/src/core/lib/iomgr/wakeup_fd_posix.c +6 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.h +9 -6
- data/src/core/lib/iomgr/workqueue.h +5 -4
- data/src/core/lib/iomgr/workqueue_posix.c +40 -26
- data/src/core/lib/iomgr/workqueue_windows.c +2 -2
- data/src/core/lib/profiling/basic_timers.c +2 -2
- data/src/core/lib/security/{security_context.c → context/security_context.c} +1 -1
- data/src/core/lib/security/{security_context.h → context/security_context.h} +4 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.c +263 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
- data/src/core/lib/security/credentials/credentials.c +233 -0
- data/src/core/lib/security/{credentials.h → credentials/credentials.h} +19 -157
- data/src/core/lib/security/{credentials_metadata.c → credentials/credentials_metadata.c} +1 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +139 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +56 -0
- data/src/core/lib/security/{credentials_posix.c → credentials/google_default/credentials_posix.c} +1 -1
- data/src/core/lib/security/{credentials_win32.c → credentials/google_default/credentials_windows.c} +3 -3
- data/src/core/lib/security/{google_default_credentials.c → credentials/google_default/google_default_credentials.c} +93 -35
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +46 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
- data/src/core/lib/security/{json_token.c → credentials/jwt/json_token.c} +10 -101
- data/src/core/lib/security/{json_token.h → credentials/jwt/json_token.h} +3 -33
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +160 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +62 -0
- data/src/core/lib/security/{jwt_verifier.c → credentials/jwt/jwt_verifier.c} +35 -15
- data/src/core/lib/security/{jwt_verifier.h → credentials/jwt/jwt_verifier.h} +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +433 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +129 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +240 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
- data/src/core/lib/security/{auth_filters.h → transport/auth_filters.h} +3 -3
- data/src/core/lib/security/{client_auth_filter.c → transport/client_auth_filter.c} +27 -20
- data/src/core/lib/security/{handshake.c → transport/handshake.c} +77 -45
- data/src/core/lib/security/{handshake.h → transport/handshake.h} +9 -11
- data/src/core/lib/security/{secure_endpoint.c → transport/secure_endpoint.c} +19 -12
- data/src/core/lib/security/{secure_endpoint.h → transport/secure_endpoint.h} +3 -3
- data/src/core/lib/security/{security_connector.c → transport/security_connector.c} +26 -17
- data/src/core/lib/security/{security_connector.h → transport/security_connector.h} +8 -8
- data/src/core/lib/security/{server_auth_filter.c → transport/server_auth_filter.c} +24 -16
- data/src/core/lib/security/transport/tsi_error.c +40 -0
- data/src/core/lib/security/transport/tsi_error.h +42 -0
- data/src/core/lib/security/{b64.c → util/b64.c} +1 -1
- data/src/core/lib/security/{b64.h → util/b64.h} +3 -3
- data/src/core/lib/security/util/json_util.c +61 -0
- data/src/core/lib/security/util/json_util.h +55 -0
- data/src/core/lib/support/avl.c +11 -0
- data/src/core/lib/support/cpu_windows.c +2 -2
- data/src/core/lib/support/{env_win32.c → env_windows.c} +3 -3
- data/src/core/lib/support/log.c +3 -1
- data/src/core/lib/support/log_linux.c +2 -2
- data/src/core/lib/support/{log_win32.c → log_windows.c} +4 -4
- data/src/core/lib/support/murmur_hash.c +3 -5
- data/src/core/lib/support/string.c +10 -0
- data/src/core/lib/support/string.h +4 -0
- data/src/core/lib/support/{string_util_win32.c → string_util_windows.c} +3 -3
- data/src/core/lib/support/{string_win32.c → string_windows.c} +2 -2
- data/src/core/lib/support/{string_win32.h → string_windows.h} +5 -5
- data/src/core/lib/support/subprocess_windows.c +1 -1
- data/src/core/lib/support/{sync_win32.c → sync_windows.c} +2 -2
- data/src/core/lib/support/{thd_win32.c → thd_windows.c} +2 -2
- data/src/core/lib/support/{time_win32.c → time_windows.c} +2 -2
- data/src/core/lib/support/tmpfile_msys.c +1 -1
- data/src/core/lib/support/{tmpfile_win32.c → tmpfile_windows.c} +3 -3
- data/src/core/lib/surface/alarm.c +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +13 -6
- data/src/core/lib/surface/call.c +323 -123
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/call_log_batch.c +1 -1
- data/src/core/lib/surface/channel.c +64 -15
- data/src/core/lib/surface/channel.h +9 -0
- data/src/core/lib/surface/channel_ping.c +3 -3
- data/src/core/lib/surface/completion_queue.c +75 -19
- data/src/core/lib/surface/completion_queue.h +7 -2
- data/src/core/lib/surface/init.c +2 -1
- data/src/core/lib/surface/init_secure.c +4 -4
- data/src/core/lib/surface/lame_client.c +12 -8
- data/src/core/lib/surface/server.c +213 -120
- data/src/core/lib/surface/server.h +1 -0
- data/src/core/lib/surface/version.c +1 -1
- data/src/core/lib/transport/connectivity_state.c +40 -18
- data/src/core/lib/transport/connectivity_state.h +4 -1
- data/src/core/lib/transport/metadata.c +23 -23
- data/src/core/lib/transport/metadata.h +4 -0
- data/src/core/lib/transport/metadata_batch.c +9 -0
- data/src/core/lib/transport/metadata_batch.h +3 -0
- data/src/core/lib/transport/static_metadata.c +6 -5
- data/src/core/lib/transport/static_metadata.h +64 -60
- data/src/core/lib/transport/transport.c +24 -12
- data/src/core/lib/transport/transport.h +6 -5
- data/src/core/lib/transport/transport_impl.h +4 -0
- data/src/core/lib/transport/transport_op_string.c +2 -2
- data/src/core/plugin_registry/grpc_plugin_registry.c +4 -0
- data/src/ruby/bin/math_services.rb +41 -2
- data/src/ruby/ext/grpc/rb_call.c +42 -40
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/ext/grpc/rb_completion_queue.c +59 -6
- data/src/ruby/ext/grpc/rb_completion_queue.h +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +1 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -5
- data/src/ruby/ext/grpc/rb_loader.c +1 -1
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc.rb +0 -3
- data/src/ruby/lib/grpc/errors.rb +3 -2
- data/src/ruby/lib/grpc/generic/active_call.rb +32 -42
- data/src/ruby/lib/grpc/generic/bidi_call.rb +20 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +31 -54
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_server.rb +12 -23
- data/src/ruby/lib/grpc/generic/service.rb +8 -8
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services.rb +30 -2
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +34 -4
- data/src/ruby/pb/grpc/testing/metrics_services.rb +39 -2
- data/src/ruby/pb/src/proto/grpc/testing/empty.rb +15 -0
- data/src/ruby/pb/src/proto/grpc/testing/messages.rb +84 -0
- data/src/ruby/pb/src/proto/grpc/testing/test.rb +14 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services.rb +110 -0
- data/src/ruby/pb/test/client.rb +5 -2
- data/src/ruby/spec/generic/active_call_spec.rb +3 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +27 -24
- data/src/ruby/spec/generic/rpc_desc_spec.rb +11 -11
- data/src/ruby/spec/generic/rpc_server_spec.rb +42 -61
- data/src/ruby/spec/pb/health/checker_spec.rb +3 -5
- metadata +86 -48
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h +0 -182
- data/src/core/lib/security/credentials.c +0 -1296
- data/src/ruby/lib/grpc/signals.rb +0 -69
@@ -91,14 +91,14 @@ static void client_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
91
91
|
}
|
92
92
|
|
93
93
|
static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
|
94
|
-
|
94
|
+
grpc_error *error) {
|
95
95
|
grpc_call_element *elem = ptr;
|
96
96
|
call_data *calld = elem->call_data;
|
97
97
|
channel_data *chand = elem->channel_data;
|
98
|
-
if (
|
98
|
+
if (error == GRPC_ERROR_NONE) {
|
99
99
|
extract_and_annotate_method_tag(calld->recv_initial_metadata, calld, chand);
|
100
100
|
}
|
101
|
-
calld->on_done_recv->cb(exec_ctx, calld->on_done_recv->cb_arg,
|
101
|
+
calld->on_done_recv->cb(exec_ctx, calld->on_done_recv->cb_arg, error);
|
102
102
|
}
|
103
103
|
|
104
104
|
static void server_mutate_op(grpc_call_element *elem,
|
@@ -134,7 +134,9 @@ static void client_init_call_elem(grpc_exec_ctx *exec_ctx,
|
|
134
134
|
}
|
135
135
|
|
136
136
|
static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
137
|
-
grpc_call_element *elem,
|
137
|
+
grpc_call_element *elem,
|
138
|
+
const grpc_call_stats *stats,
|
139
|
+
void *ignored) {
|
138
140
|
call_data *d = elem->call_data;
|
139
141
|
GPR_ASSERT(d != NULL);
|
140
142
|
/* TODO(hongyu): record rpc client stats and census_rpc_end_op here */
|
@@ -152,7 +154,9 @@ static void server_init_call_elem(grpc_exec_ctx *exec_ctx,
|
|
152
154
|
}
|
153
155
|
|
154
156
|
static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
155
|
-
grpc_call_element *elem,
|
157
|
+
grpc_call_element *elem,
|
158
|
+
const grpc_call_stats *stats,
|
159
|
+
void *ignored) {
|
156
160
|
call_data *d = elem->call_data;
|
157
161
|
GPR_ASSERT(d != NULL);
|
158
162
|
/* TODO(hongyu): record rpc server stats and census_tracing_end_op here */
|
@@ -176,7 +180,7 @@ const grpc_channel_filter grpc_client_census_filter = {
|
|
176
180
|
grpc_channel_next_op,
|
177
181
|
sizeof(call_data),
|
178
182
|
client_init_call_elem,
|
179
|
-
|
183
|
+
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
180
184
|
client_destroy_call_elem,
|
181
185
|
sizeof(channel_data),
|
182
186
|
init_channel_elem,
|
@@ -189,7 +193,7 @@ const grpc_channel_filter grpc_server_census_filter = {
|
|
189
193
|
grpc_channel_next_op,
|
190
194
|
sizeof(call_data),
|
191
195
|
server_init_call_elem,
|
192
|
-
|
196
|
+
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
193
197
|
server_destroy_call_elem,
|
194
198
|
sizeof(channel_data),
|
195
199
|
init_channel_elem,
|
@@ -62,7 +62,7 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
|
|
62
62
|
"not a (u)client channel, but '%s'",
|
63
63
|
client_channel_elem->filter->name);
|
64
64
|
grpc_exec_ctx_finish(&exec_ctx);
|
65
|
-
return
|
65
|
+
return GRPC_CHANNEL_SHUTDOWN;
|
66
66
|
}
|
67
67
|
|
68
68
|
typedef enum {
|
@@ -75,7 +75,6 @@ typedef enum {
|
|
75
75
|
typedef struct {
|
76
76
|
gpr_mu mu;
|
77
77
|
callback_phase phase;
|
78
|
-
int success;
|
79
78
|
grpc_closure on_complete;
|
80
79
|
grpc_timer alarm;
|
81
80
|
grpc_connectivity_state state;
|
@@ -122,7 +121,7 @@ static void finished_completion(grpc_exec_ctx *exec_ctx, void *pw,
|
|
122
121
|
}
|
123
122
|
|
124
123
|
static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
|
125
|
-
|
124
|
+
bool due_to_completion, grpc_error *error) {
|
126
125
|
int delete = 0;
|
127
126
|
|
128
127
|
if (due_to_completion) {
|
@@ -130,14 +129,26 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
|
|
130
129
|
}
|
131
130
|
|
132
131
|
gpr_mu_lock(&w->mu);
|
132
|
+
|
133
133
|
if (due_to_completion) {
|
134
|
-
|
134
|
+
if (grpc_trace_operation_failures) {
|
135
|
+
GRPC_LOG_IF_ERROR("watch_completion_error", GRPC_ERROR_REF(error));
|
136
|
+
}
|
137
|
+
GRPC_ERROR_UNREF(error);
|
138
|
+
error = GRPC_ERROR_NONE;
|
139
|
+
} else {
|
140
|
+
if (error == GRPC_ERROR_NONE) {
|
141
|
+
error =
|
142
|
+
GRPC_ERROR_CREATE("Timed out waiting for connection state change");
|
143
|
+
} else if (error == GRPC_ERROR_CANCELLED) {
|
144
|
+
error = GRPC_ERROR_NONE;
|
145
|
+
}
|
135
146
|
}
|
136
147
|
switch (w->phase) {
|
137
148
|
case WAITING:
|
138
149
|
w->phase = CALLING_BACK;
|
139
|
-
grpc_cq_end_op(exec_ctx, w->cq, w->tag,
|
140
|
-
w, &w->completion_storage);
|
150
|
+
grpc_cq_end_op(exec_ctx, w->cq, w->tag, GRPC_ERROR_REF(error),
|
151
|
+
finished_completion, w, &w->completion_storage);
|
141
152
|
break;
|
142
153
|
case CALLING_BACK:
|
143
154
|
w->phase = CALLING_BACK_AND_FINISHED;
|
@@ -153,14 +164,18 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
|
|
153
164
|
if (delete) {
|
154
165
|
delete_state_watcher(exec_ctx, w);
|
155
166
|
}
|
167
|
+
|
168
|
+
GRPC_ERROR_UNREF(error);
|
156
169
|
}
|
157
170
|
|
158
|
-
static void watch_complete(grpc_exec_ctx *exec_ctx, void *pw,
|
159
|
-
|
171
|
+
static void watch_complete(grpc_exec_ctx *exec_ctx, void *pw,
|
172
|
+
grpc_error *error) {
|
173
|
+
partly_done(exec_ctx, pw, true, GRPC_ERROR_REF(error));
|
160
174
|
}
|
161
175
|
|
162
|
-
static void timeout_complete(grpc_exec_ctx *exec_ctx, void *pw,
|
163
|
-
|
176
|
+
static void timeout_complete(grpc_exec_ctx *exec_ctx, void *pw,
|
177
|
+
grpc_error *error) {
|
178
|
+
partly_done(exec_ctx, pw, false, GRPC_ERROR_REF(error));
|
164
179
|
}
|
165
180
|
|
166
181
|
void grpc_channel_watch_connectivity_state(
|
@@ -174,10 +189,10 @@ void grpc_channel_watch_connectivity_state(
|
|
174
189
|
GRPC_API_TRACE(
|
175
190
|
"grpc_channel_watch_connectivity_state("
|
176
191
|
"channel=%p, last_observed_state=%d, "
|
177
|
-
"deadline=gpr_timespec { tv_sec: %
|
192
|
+
"deadline=gpr_timespec { tv_sec: %"PRId64", tv_nsec: %d, clock_type: %d }, "
|
178
193
|
"cq=%p, tag=%p)",
|
179
|
-
7, (channel, (int)last_observed_state,
|
180
|
-
|
194
|
+
7, (channel, (int)last_observed_state, deadline.tv_sec,
|
195
|
+
deadline.tv_nsec, (int)deadline.clock_type, cq, tag));
|
181
196
|
|
182
197
|
grpc_cq_begin_op(cq, tag);
|
183
198
|
|
@@ -185,7 +200,6 @@ void grpc_channel_watch_connectivity_state(
|
|
185
200
|
grpc_closure_init(&w->on_complete, watch_complete, w);
|
186
201
|
w->phase = WAITING;
|
187
202
|
w->state = last_observed_state;
|
188
|
-
w->success = 0;
|
189
203
|
w->cq = cq;
|
190
204
|
w->tag = tag;
|
191
205
|
w->channel = channel;
|
@@ -117,9 +117,10 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
|
|
117
117
|
static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
|
118
118
|
channel_data *chand,
|
119
119
|
grpc_connectivity_state state,
|
120
|
+
grpc_error *error,
|
120
121
|
const char *reason) {
|
121
122
|
if ((state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
|
122
|
-
state ==
|
123
|
+
state == GRPC_CHANNEL_SHUTDOWN) &&
|
123
124
|
chand->lb_policy != NULL) {
|
124
125
|
/* cancel fail-fast picks */
|
125
126
|
grpc_lb_policy_cancel_picks(
|
@@ -127,35 +128,36 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
|
|
127
128
|
/* mask= */ GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY,
|
128
129
|
/* check= */ 0);
|
129
130
|
}
|
130
|
-
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state,
|
131
|
+
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, error,
|
132
|
+
reason);
|
131
133
|
}
|
132
134
|
|
133
|
-
static void on_lb_policy_state_changed_locked(
|
134
|
-
|
135
|
+
static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx,
|
136
|
+
lb_policy_connectivity_watcher *w,
|
137
|
+
grpc_error *error) {
|
135
138
|
grpc_connectivity_state publish_state = w->state;
|
136
139
|
/* check if the notification is for a stale policy */
|
137
140
|
if (w->lb_policy != w->chand->lb_policy) return;
|
138
141
|
|
139
|
-
if (publish_state ==
|
140
|
-
w->chand->resolver != NULL) {
|
142
|
+
if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) {
|
141
143
|
publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
142
144
|
grpc_resolver_channel_saw_error(exec_ctx, w->chand->resolver);
|
143
145
|
GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel");
|
144
146
|
w->chand->lb_policy = NULL;
|
145
147
|
}
|
146
148
|
set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state,
|
147
|
-
"lb_changed");
|
148
|
-
if (w->state !=
|
149
|
+
GRPC_ERROR_REF(error), "lb_changed");
|
150
|
+
if (w->state != GRPC_CHANNEL_SHUTDOWN) {
|
149
151
|
watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state);
|
150
152
|
}
|
151
153
|
}
|
152
154
|
|
153
155
|
static void on_lb_policy_state_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
154
|
-
|
156
|
+
grpc_error *error) {
|
155
157
|
lb_policy_connectivity_watcher *w = arg;
|
156
158
|
|
157
159
|
gpr_mu_lock(&w->chand->mu_config);
|
158
|
-
on_lb_policy_state_changed_locked(exec_ctx, w);
|
160
|
+
on_lb_policy_state_changed_locked(exec_ctx, w, error);
|
159
161
|
gpr_mu_unlock(&w->chand->mu_config);
|
160
162
|
|
161
163
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy");
|
@@ -177,19 +179,22 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
|
|
177
179
|
}
|
178
180
|
|
179
181
|
static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
180
|
-
|
182
|
+
grpc_error *error) {
|
181
183
|
channel_data *chand = arg;
|
182
184
|
grpc_lb_policy *lb_policy = NULL;
|
183
185
|
grpc_lb_policy *old_lb_policy;
|
184
186
|
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
|
185
187
|
int exit_idle = 0;
|
188
|
+
grpc_error *state_error = GRPC_ERROR_CREATE("No load balancing policy");
|
186
189
|
|
187
190
|
if (chand->incoming_configuration != NULL) {
|
188
191
|
lb_policy = grpc_client_config_get_lb_policy(chand->incoming_configuration);
|
189
192
|
if (lb_policy != NULL) {
|
190
193
|
GRPC_LB_POLICY_REF(lb_policy, "channel");
|
191
194
|
GRPC_LB_POLICY_REF(lb_policy, "config_change");
|
192
|
-
|
195
|
+
GRPC_ERROR_UNREF(state_error);
|
196
|
+
state =
|
197
|
+
grpc_lb_policy_check_connectivity(exec_ctx, lb_policy, &state_error);
|
193
198
|
}
|
194
199
|
|
195
200
|
grpc_client_config_unref(exec_ctx, chand->incoming_configuration);
|
@@ -209,7 +214,9 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
|
209
214
|
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
|
210
215
|
NULL);
|
211
216
|
} else if (chand->resolver == NULL /* disconnected */) {
|
212
|
-
grpc_closure_list_fail_all(
|
217
|
+
grpc_closure_list_fail_all(
|
218
|
+
&chand->waiting_for_config_closures,
|
219
|
+
GRPC_ERROR_CREATE_REFERENCING("Channel disconnected", &error, 1));
|
213
220
|
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
|
214
221
|
NULL);
|
215
222
|
}
|
@@ -219,9 +226,9 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
|
219
226
|
chand->exit_idle_when_lb_policy_arrives = 0;
|
220
227
|
}
|
221
228
|
|
222
|
-
if (
|
223
|
-
set_channel_connectivity_state_locked(
|
224
|
-
|
229
|
+
if (error == GRPC_ERROR_NONE && chand->resolver) {
|
230
|
+
set_channel_connectivity_state_locked(
|
231
|
+
exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver");
|
225
232
|
if (lb_policy != NULL) {
|
226
233
|
watch_lb_policy(exec_ctx, chand, lb_policy, state);
|
227
234
|
}
|
@@ -236,8 +243,12 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
|
236
243
|
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
|
237
244
|
chand->resolver = NULL;
|
238
245
|
}
|
246
|
+
grpc_error *refs[] = {error, state_error};
|
239
247
|
set_channel_connectivity_state_locked(
|
240
|
-
exec_ctx, chand,
|
248
|
+
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
|
249
|
+
GRPC_ERROR_CREATE_REFERENCING("Got config after disconnection", refs,
|
250
|
+
GPR_ARRAY_SIZE(refs)),
|
251
|
+
"resolver_gone");
|
241
252
|
gpr_mu_unlock(&chand->mu_config);
|
242
253
|
}
|
243
254
|
|
@@ -257,6 +268,7 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
|
|
257
268
|
}
|
258
269
|
|
259
270
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver");
|
271
|
+
GRPC_ERROR_UNREF(state_error);
|
260
272
|
}
|
261
273
|
|
262
274
|
static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
@@ -264,7 +276,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
264
276
|
grpc_transport_op *op) {
|
265
277
|
channel_data *chand = elem->channel_data;
|
266
278
|
|
267
|
-
|
279
|
+
grpc_exec_ctx_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE, NULL);
|
268
280
|
|
269
281
|
GPR_ASSERT(op->set_accept_stream == false);
|
270
282
|
if (op->bind_pollset != NULL) {
|
@@ -283,7 +295,9 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
283
295
|
|
284
296
|
if (op->send_ping != NULL) {
|
285
297
|
if (chand->lb_policy == NULL) {
|
286
|
-
|
298
|
+
grpc_exec_ctx_sched(exec_ctx, op->send_ping,
|
299
|
+
GRPC_ERROR_CREATE("Ping with no load balancing"),
|
300
|
+
NULL);
|
287
301
|
} else {
|
288
302
|
grpc_lb_policy_ping_one(exec_ctx, chand->lb_policy, op->send_ping);
|
289
303
|
op->bind_pollset = NULL;
|
@@ -291,24 +305,29 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
291
305
|
op->send_ping = NULL;
|
292
306
|
}
|
293
307
|
|
294
|
-
if (op->
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
308
|
+
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
|
309
|
+
if (chand->resolver != NULL) {
|
310
|
+
set_channel_connectivity_state_locked(
|
311
|
+
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
|
312
|
+
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
|
313
|
+
grpc_resolver_shutdown(exec_ctx, chand->resolver);
|
314
|
+
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
|
315
|
+
chand->resolver = NULL;
|
316
|
+
if (!chand->started_resolving) {
|
317
|
+
grpc_closure_list_fail_all(&chand->waiting_for_config_closures,
|
318
|
+
GRPC_ERROR_REF(op->disconnect_with_error));
|
319
|
+
grpc_exec_ctx_enqueue_list(exec_ctx,
|
320
|
+
&chand->waiting_for_config_closures, NULL);
|
321
|
+
}
|
322
|
+
if (chand->lb_policy != NULL) {
|
323
|
+
grpc_pollset_set_del_pollset_set(exec_ctx,
|
324
|
+
chand->lb_policy->interested_parties,
|
325
|
+
chand->interested_parties);
|
326
|
+
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
|
327
|
+
chand->lb_policy = NULL;
|
328
|
+
}
|
311
329
|
}
|
330
|
+
GRPC_ERROR_UNREF(op->disconnect_with_error);
|
312
331
|
}
|
313
332
|
gpr_mu_unlock(&chand->mu_config);
|
314
333
|
}
|
@@ -328,16 +347,17 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
|
|
328
347
|
grpc_connected_subchannel **connected_subchannel,
|
329
348
|
grpc_closure *on_ready);
|
330
349
|
|
331
|
-
static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg,
|
350
|
+
static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg,
|
351
|
+
grpc_error *error) {
|
332
352
|
continue_picking_args *cpa = arg;
|
333
353
|
if (cpa->connected_subchannel == NULL) {
|
334
354
|
/* cancelled, do nothing */
|
335
|
-
} else if (
|
336
|
-
|
355
|
+
} else if (error != GRPC_ERROR_NONE) {
|
356
|
+
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error), NULL);
|
337
357
|
} else if (cc_pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata,
|
338
358
|
cpa->initial_metadata_flags,
|
339
359
|
cpa->connected_subchannel, cpa->on_ready)) {
|
340
|
-
|
360
|
+
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE, NULL);
|
341
361
|
}
|
342
362
|
gpr_free(cpa);
|
343
363
|
}
|
@@ -362,11 +382,12 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
|
|
362
382
|
connected_subchannel);
|
363
383
|
}
|
364
384
|
for (closure = chand->waiting_for_config_closures.head; closure != NULL;
|
365
|
-
closure =
|
385
|
+
closure = closure->next_data.next) {
|
366
386
|
cpa = closure->cb_arg;
|
367
387
|
if (cpa->connected_subchannel == connected_subchannel) {
|
368
388
|
cpa->connected_subchannel = NULL;
|
369
|
-
|
389
|
+
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready,
|
390
|
+
GRPC_ERROR_CREATE("Pick cancelled"), NULL);
|
370
391
|
}
|
371
392
|
}
|
372
393
|
gpr_mu_unlock(&chand->mu_config);
|
@@ -377,7 +398,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
|
|
377
398
|
int r;
|
378
399
|
GRPC_LB_POLICY_REF(lb_policy, "cc_pick_subchannel");
|
379
400
|
gpr_mu_unlock(&chand->mu_config);
|
380
|
-
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->
|
401
|
+
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollent,
|
381
402
|
initial_metadata, initial_metadata_flags,
|
382
403
|
connected_subchannel, on_ready);
|
383
404
|
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "cc_pick_subchannel");
|
@@ -398,10 +419,11 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
|
|
398
419
|
cpa->on_ready = on_ready;
|
399
420
|
cpa->elem = elem;
|
400
421
|
grpc_closure_init(&cpa->closure, continue_picking, cpa);
|
401
|
-
|
402
|
-
|
422
|
+
grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure,
|
423
|
+
GRPC_ERROR_NONE);
|
403
424
|
} else {
|
404
|
-
|
425
|
+
grpc_exec_ctx_sched(exec_ctx, on_ready, GRPC_ERROR_CREATE("Disconnected"),
|
426
|
+
NULL);
|
405
427
|
}
|
406
428
|
gpr_mu_unlock(&chand->mu_config);
|
407
429
|
return 0;
|
@@ -416,6 +438,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
|
416
438
|
|
417
439
|
/* Destructor for call_data */
|
418
440
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
441
|
+
const grpc_call_stats *stats,
|
419
442
|
void *and_free_memory) {
|
420
443
|
grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
|
421
444
|
gpr_free(and_free_memory);
|
@@ -461,10 +484,11 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
461
484
|
gpr_mu_destroy(&chand->mu_config);
|
462
485
|
}
|
463
486
|
|
464
|
-
static void
|
465
|
-
|
487
|
+
static void cc_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
488
|
+
grpc_call_element *elem,
|
489
|
+
grpc_polling_entity *pollent) {
|
466
490
|
call_data *calld = elem->call_data;
|
467
|
-
calld->
|
491
|
+
calld->pollent = pollent;
|
468
492
|
}
|
469
493
|
|
470
494
|
const grpc_channel_filter grpc_client_channel_filter = {
|
@@ -472,7 +496,7 @@ const grpc_channel_filter grpc_client_channel_filter = {
|
|
472
496
|
cc_start_transport_op,
|
473
497
|
sizeof(call_data),
|
474
498
|
init_call_elem,
|
475
|
-
|
499
|
+
cc_set_pollset_or_pollset_set,
|
476
500
|
destroy_call_elem,
|
477
501
|
sizeof(channel_data),
|
478
502
|
init_channel_elem,
|
@@ -506,7 +530,7 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
|
|
506
530
|
channel_data *chand = elem->channel_data;
|
507
531
|
grpc_connectivity_state out;
|
508
532
|
gpr_mu_lock(&chand->mu_config);
|
509
|
-
out = grpc_connectivity_state_check(&chand->state_tracker);
|
533
|
+
out = grpc_connectivity_state_check(&chand->state_tracker, NULL);
|
510
534
|
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
|
511
535
|
if (chand->lb_policy != NULL) {
|
512
536
|
grpc_lb_policy_exit_idle(exec_ctx, chand->lb_policy);
|
@@ -533,7 +557,7 @@ typedef struct {
|
|
533
557
|
} external_connectivity_watcher;
|
534
558
|
|
535
559
|
static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg,
|
536
|
-
|
560
|
+
grpc_error *error) {
|
537
561
|
external_connectivity_watcher *w = arg;
|
538
562
|
grpc_closure *follow_up = w->on_complete;
|
539
563
|
grpc_pollset_set_del_pollset(exec_ctx, w->chand->interested_parties,
|
@@ -541,7 +565,7 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg,
|
|
541
565
|
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
|
542
566
|
"external_connectivity_watcher");
|
543
567
|
gpr_free(w);
|
544
|
-
follow_up->cb(exec_ctx, follow_up->cb_arg,
|
568
|
+
follow_up->cb(exec_ctx, follow_up->cb_arg, error);
|
545
569
|
}
|
546
570
|
|
547
571
|
void grpc_client_channel_watch_connectivity_state(
|