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
@@ -60,8 +60,9 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta,
|
|
60
60
|
: gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta);
|
61
61
|
#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG
|
62
62
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
63
|
-
"LB_POLICY: %
|
64
|
-
|
63
|
+
"LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR
|
64
|
+
" [%s]",
|
65
|
+
(intptr_t)c, purpose, old_val, old_val + delta, reason);
|
65
66
|
#endif
|
66
67
|
return old_val;
|
67
68
|
}
|
@@ -99,12 +100,12 @@ void grpc_lb_policy_weak_unref(grpc_exec_ctx *exec_ctx,
|
|
99
100
|
}
|
100
101
|
|
101
102
|
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
102
|
-
|
103
|
+
grpc_polling_entity *pollent,
|
103
104
|
grpc_metadata_batch *initial_metadata,
|
104
105
|
uint32_t initial_metadata_flags,
|
105
106
|
grpc_connected_subchannel **target,
|
106
107
|
grpc_closure *on_complete) {
|
107
|
-
return policy->vtable->pick(exec_ctx, policy,
|
108
|
+
return policy->vtable->pick(exec_ctx, policy, pollent, initial_metadata,
|
108
109
|
initial_metadata_flags, target, on_complete);
|
109
110
|
}
|
110
111
|
|
@@ -138,6 +139,8 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
|
|
138
139
|
}
|
139
140
|
|
140
141
|
grpc_connectivity_state grpc_lb_policy_check_connectivity(
|
141
|
-
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy
|
142
|
-
|
142
|
+
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
143
|
+
grpc_error **connectivity_error) {
|
144
|
+
return policy->vtable->check_connectivity(exec_ctx, policy,
|
145
|
+
connectivity_error);
|
143
146
|
}
|
@@ -35,6 +35,7 @@
|
|
35
35
|
#define GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H
|
36
36
|
|
37
37
|
#include "src/core/ext/client_config/subchannel.h"
|
38
|
+
#include "src/core/lib/iomgr/polling_entity.h"
|
38
39
|
#include "src/core/lib/transport/connectivity_state.h"
|
39
40
|
|
40
41
|
/** A load balancing policy: specified by a vtable and a struct (which
|
@@ -59,7 +60,8 @@ struct grpc_lb_policy_vtable {
|
|
59
60
|
|
60
61
|
/** implement grpc_lb_policy_pick */
|
61
62
|
int (*pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
62
|
-
|
63
|
+
grpc_polling_entity *pollent,
|
64
|
+
grpc_metadata_batch *initial_metadata,
|
63
65
|
uint32_t initial_metadata_flags,
|
64
66
|
grpc_connected_subchannel **target, grpc_closure *on_complete);
|
65
67
|
void (*cancel_pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
@@ -75,8 +77,9 @@ struct grpc_lb_policy_vtable {
|
|
75
77
|
void (*exit_idle)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
|
76
78
|
|
77
79
|
/** check the current connectivity of the lb_policy */
|
78
|
-
grpc_connectivity_state (*check_connectivity)(
|
79
|
-
|
80
|
+
grpc_connectivity_state (*check_connectivity)(
|
81
|
+
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
82
|
+
grpc_error **connectivity_error);
|
80
83
|
|
81
84
|
/** call notify when the connectivity state of a channel changes from *state.
|
82
85
|
Updates *state with the new state of the policy */
|
@@ -124,7 +127,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy,
|
|
124
127
|
\a target.
|
125
128
|
Picking can be asynchronous. Any IO should be done under \a pollset. */
|
126
129
|
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
127
|
-
|
130
|
+
grpc_polling_entity *pollent,
|
128
131
|
grpc_metadata_batch *initial_metadata,
|
129
132
|
uint32_t initial_metadata_flags,
|
130
133
|
grpc_connected_subchannel **target,
|
@@ -152,6 +155,7 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
|
|
152
155
|
grpc_closure *closure);
|
153
156
|
|
154
157
|
grpc_connectivity_state grpc_lb_policy_check_connectivity(
|
155
|
-
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy
|
158
|
+
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
159
|
+
grpc_error **connectivity_error);
|
156
160
|
|
157
161
|
#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H */
|
@@ -54,7 +54,7 @@
|
|
54
54
|
#define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1))
|
55
55
|
|
56
56
|
#define GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS 20
|
57
|
-
#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS
|
57
|
+
#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1
|
58
58
|
#define GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER 1.6
|
59
59
|
#define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120
|
60
60
|
#define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2
|
@@ -147,7 +147,7 @@ struct grpc_subchannel_call {
|
|
147
147
|
(((grpc_subchannel_call *)(callstack)) - 1)
|
148
148
|
|
149
149
|
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
|
150
|
-
|
150
|
+
grpc_error *error);
|
151
151
|
|
152
152
|
#ifdef GRPC_STREAM_REFCOUNT_DEBUG
|
153
153
|
#define REF_REASON reason
|
@@ -177,7 +177,7 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
|
|
177
177
|
*/
|
178
178
|
|
179
179
|
static void connection_destroy(grpc_exec_ctx *exec_ctx, void *arg,
|
180
|
-
|
180
|
+
grpc_error *error) {
|
181
181
|
grpc_connected_subchannel *c = arg;
|
182
182
|
grpc_channel_stack_destroy(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c));
|
183
183
|
gpr_free(c);
|
@@ -200,7 +200,7 @@ void grpc_connected_subchannel_unref(grpc_exec_ctx *exec_ctx,
|
|
200
200
|
*/
|
201
201
|
|
202
202
|
static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg,
|
203
|
-
|
203
|
+
grpc_error *error) {
|
204
204
|
grpc_subchannel *c = arg;
|
205
205
|
gpr_free((void *)c->filters);
|
206
206
|
grpc_channel_args_destroy(c->args);
|
@@ -290,8 +290,8 @@ void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx,
|
|
290
290
|
gpr_atm old_refs;
|
291
291
|
old_refs = ref_mutate(c, -(gpr_atm)1, 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
|
292
292
|
if (old_refs == 1) {
|
293
|
-
|
294
|
-
|
293
|
+
grpc_exec_ctx_sched(exec_ctx, grpc_closure_create(subchannel_destroy, c),
|
294
|
+
GRPC_ERROR_NONE, NULL);
|
295
295
|
}
|
296
296
|
}
|
297
297
|
|
@@ -320,7 +320,7 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
|
|
320
320
|
c->filters = NULL;
|
321
321
|
}
|
322
322
|
c->addr = gpr_malloc(args->addr_len);
|
323
|
-
memcpy(c->addr, args->addr, args->addr_len);
|
323
|
+
if (args->addr_len) memcpy(c->addr, args->addr, args->addr_len);
|
324
324
|
c->pollset_set = grpc_pollset_set_create();
|
325
325
|
c->addr_len = args->addr_len;
|
326
326
|
grpc_set_initial_connect_string(&c->addr, &c->addr_len,
|
@@ -382,7 +382,8 @@ static void continue_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
|
|
382
382
|
args.initial_connect_string = c->initial_connect_string;
|
383
383
|
|
384
384
|
grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
|
385
|
-
GRPC_CHANNEL_CONNECTING,
|
385
|
+
GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE,
|
386
|
+
"state_change");
|
386
387
|
grpc_connector_connect(exec_ctx, c->connector, &args, &c->connecting_result,
|
387
388
|
&c->connected);
|
388
389
|
}
|
@@ -393,16 +394,17 @@ static void start_connect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
|
|
393
394
|
continue_connect(exec_ctx, c);
|
394
395
|
}
|
395
396
|
|
396
|
-
grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c
|
397
|
+
grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c,
|
398
|
+
grpc_error **error) {
|
397
399
|
grpc_connectivity_state state;
|
398
400
|
gpr_mu_lock(&c->mu);
|
399
|
-
state = grpc_connectivity_state_check(&c->state_tracker);
|
401
|
+
state = grpc_connectivity_state_check(&c->state_tracker, error);
|
400
402
|
gpr_mu_unlock(&c->mu);
|
401
403
|
return state;
|
402
404
|
}
|
403
405
|
|
404
406
|
static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg,
|
405
|
-
|
407
|
+
grpc_error *error) {
|
406
408
|
external_state_watcher *w = arg;
|
407
409
|
grpc_closure *follow_up = w->notify;
|
408
410
|
if (w->pollset_set != NULL) {
|
@@ -415,7 +417,7 @@ static void on_external_state_watcher_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
415
417
|
gpr_mu_unlock(&w->subchannel->mu);
|
416
418
|
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, w->subchannel, "external_state_watcher");
|
417
419
|
gpr_free(w);
|
418
|
-
follow_up->cb(exec_ctx, follow_up->cb_arg,
|
420
|
+
follow_up->cb(exec_ctx, follow_up->cb_arg, error);
|
419
421
|
}
|
420
422
|
|
421
423
|
void grpc_subchannel_notify_on_state_change(
|
@@ -469,7 +471,7 @@ void grpc_connected_subchannel_process_transport_op(
|
|
469
471
|
}
|
470
472
|
|
471
473
|
static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
|
472
|
-
|
474
|
+
grpc_error *error) {
|
473
475
|
state_watcher *sw = p;
|
474
476
|
grpc_subchannel *c = sw->subchannel;
|
475
477
|
gpr_mu *mu = &c->mu;
|
@@ -477,20 +479,19 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx *exec_ctx, void *p,
|
|
477
479
|
gpr_mu_lock(mu);
|
478
480
|
|
479
481
|
/* if we failed just leave this closure */
|
480
|
-
if (
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
}
|
482
|
+
if (sw->connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
483
|
+
/* any errors on a subchannel ==> we're done, create a new one */
|
484
|
+
sw->connectivity_state = GRPC_CHANNEL_SHUTDOWN;
|
485
|
+
}
|
486
|
+
grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
|
487
|
+
sw->connectivity_state, GRPC_ERROR_REF(error),
|
488
|
+
"reflect_child");
|
489
|
+
if (sw->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
|
490
|
+
grpc_connected_subchannel_notify_on_state_change(
|
491
|
+
exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), NULL,
|
492
|
+
&sw->connectivity_state, &sw->closure);
|
493
|
+
GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
|
494
|
+
sw = NULL;
|
494
495
|
}
|
495
496
|
|
496
497
|
gpr_mu_unlock(mu);
|
@@ -592,17 +593,20 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
592
593
|
|
593
594
|
/* signal completion */
|
594
595
|
grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY,
|
595
|
-
"connected");
|
596
|
+
GRPC_ERROR_NONE, "connected");
|
596
597
|
}
|
597
598
|
|
598
|
-
static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg,
|
599
|
+
static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
599
600
|
grpc_subchannel *c = arg;
|
600
601
|
gpr_mu_lock(&c->mu);
|
601
602
|
c->have_alarm = 0;
|
602
603
|
if (c->disconnected) {
|
603
|
-
|
604
|
+
error = GRPC_ERROR_CREATE_REFERENCING("Disconnected", &error, 1);
|
605
|
+
} else {
|
606
|
+
GRPC_ERROR_REF(error);
|
604
607
|
}
|
605
|
-
if (
|
608
|
+
if (error == GRPC_ERROR_NONE) {
|
609
|
+
gpr_log(GPR_INFO, "Failed to connect to channel, retrying");
|
606
610
|
c->next_attempt =
|
607
611
|
gpr_backoff_step(&c->backoff_state, gpr_now(GPR_CLOCK_MONOTONIC));
|
608
612
|
continue_connect(exec_ctx, c);
|
@@ -611,11 +615,13 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
|
|
611
615
|
gpr_mu_unlock(&c->mu);
|
612
616
|
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
|
613
617
|
}
|
618
|
+
GRPC_ERROR_UNREF(error);
|
614
619
|
}
|
615
620
|
|
616
621
|
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
617
|
-
|
622
|
+
grpc_error *error) {
|
618
623
|
grpc_subchannel *c = arg;
|
624
|
+
grpc_channel_args *delete_channel_args = c->connecting_result.channel_args;
|
619
625
|
|
620
626
|
GRPC_SUBCHANNEL_WEAK_REF(c, "connected");
|
621
627
|
gpr_mu_lock(&c->mu);
|
@@ -627,13 +633,26 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
|
627
633
|
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
628
634
|
GPR_ASSERT(!c->have_alarm);
|
629
635
|
c->have_alarm = 1;
|
630
|
-
grpc_connectivity_state_set(
|
631
|
-
|
632
|
-
|
636
|
+
grpc_connectivity_state_set(
|
637
|
+
exec_ctx, &c->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
638
|
+
GRPC_ERROR_CREATE_REFERENCING("Connect Failed", &error, 1),
|
639
|
+
"connect_failed");
|
640
|
+
gpr_timespec time_til_next = gpr_time_sub(c->next_attempt, now);
|
641
|
+
const char *errmsg = grpc_error_string(error);
|
642
|
+
gpr_log(GPR_INFO, "Connect failed: %s", errmsg);
|
643
|
+
if (gpr_time_cmp(time_til_next, gpr_time_0(time_til_next.clock_type)) <=
|
644
|
+
0) {
|
645
|
+
gpr_log(GPR_INFO, "Retry immediately");
|
646
|
+
} else {
|
647
|
+
gpr_log(GPR_INFO, "Retry in %" PRId64 ".%09d seconds",
|
648
|
+
time_til_next.tv_sec, time_til_next.tv_nsec);
|
649
|
+
}
|
633
650
|
grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now);
|
651
|
+
grpc_error_free_string(errmsg);
|
634
652
|
}
|
635
653
|
gpr_mu_unlock(&c->mu);
|
636
654
|
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
|
655
|
+
grpc_channel_args_destroy(delete_channel_args);
|
637
656
|
}
|
638
657
|
|
639
658
|
/*
|
@@ -641,11 +660,11 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
|
641
660
|
*/
|
642
661
|
|
643
662
|
static void subchannel_call_destroy(grpc_exec_ctx *exec_ctx, void *call,
|
644
|
-
|
663
|
+
grpc_error *error) {
|
645
664
|
grpc_subchannel_call *c = call;
|
646
665
|
GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
|
647
666
|
grpc_connected_subchannel *connection = c->connection;
|
648
|
-
grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), c);
|
667
|
+
grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), NULL, c);
|
649
668
|
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, connection, "subchannel_call");
|
650
669
|
GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
|
651
670
|
}
|
@@ -683,7 +702,7 @@ grpc_connected_subchannel *grpc_subchannel_get_connected_subchannel(
|
|
683
702
|
|
684
703
|
grpc_subchannel_call *grpc_connected_subchannel_create_call(
|
685
704
|
grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *con,
|
686
|
-
|
705
|
+
grpc_polling_entity *pollent) {
|
687
706
|
grpc_channel_stack *chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
|
688
707
|
grpc_subchannel_call *call =
|
689
708
|
gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
|
@@ -692,7 +711,7 @@ grpc_subchannel_call *grpc_connected_subchannel_create_call(
|
|
692
711
|
GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
|
693
712
|
grpc_call_stack_init(exec_ctx, chanstk, 1, subchannel_call_destroy, call,
|
694
713
|
NULL, NULL, callstk);
|
695
|
-
|
714
|
+
grpc_call_stack_set_pollset_or_pollset_set(exec_ctx, callstk, pollent);
|
696
715
|
return call;
|
697
716
|
}
|
698
717
|
|
@@ -36,6 +36,7 @@
|
|
36
36
|
|
37
37
|
#include "src/core/ext/client_config/connector.h"
|
38
38
|
#include "src/core/lib/channel/channel_stack.h"
|
39
|
+
#include "src/core/lib/iomgr/polling_entity.h"
|
39
40
|
#include "src/core/lib/transport/connectivity_state.h"
|
40
41
|
|
41
42
|
/** A (sub-)channel that knows how to connect to exactly one target
|
@@ -109,7 +110,7 @@ void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx,
|
|
109
110
|
/** construct a subchannel call */
|
110
111
|
grpc_subchannel_call *grpc_connected_subchannel_create_call(
|
111
112
|
grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *connected_subchannel,
|
112
|
-
|
113
|
+
grpc_polling_entity *pollent);
|
113
114
|
|
114
115
|
/** process a transport level op */
|
115
116
|
void grpc_connected_subchannel_process_transport_op(
|
@@ -118,7 +119,7 @@ void grpc_connected_subchannel_process_transport_op(
|
|
118
119
|
|
119
120
|
/** poll the current connectivity state of a channel */
|
120
121
|
grpc_connectivity_state grpc_subchannel_check_connectivity(
|
121
|
-
grpc_subchannel *channel);
|
122
|
+
grpc_subchannel *channel, grpc_error **error);
|
122
123
|
|
123
124
|
/** call notify when the connectivity state of a channel changes from *state.
|
124
125
|
Updates *state with the new state of the channel */
|
@@ -43,14 +43,14 @@
|
|
43
43
|
#define CANCELLED_CALL ((grpc_subchannel_call *)1)
|
44
44
|
|
45
45
|
static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *holder,
|
46
|
-
|
46
|
+
grpc_error *error);
|
47
47
|
static void retry_ops(grpc_exec_ctx *exec_ctx, void *retry_ops_args,
|
48
|
-
|
48
|
+
grpc_error *error);
|
49
49
|
|
50
50
|
static void add_waiting_locked(grpc_subchannel_call_holder *holder,
|
51
51
|
grpc_transport_stream_op *op);
|
52
52
|
static void fail_locked(grpc_exec_ctx *exec_ctx,
|
53
|
-
grpc_subchannel_call_holder *holder);
|
53
|
+
grpc_subchannel_call_holder *holder, grpc_error *error);
|
54
54
|
static void retry_waiting_locked(grpc_exec_ctx *exec_ctx,
|
55
55
|
grpc_subchannel_call_holder *holder);
|
56
56
|
|
@@ -68,6 +68,7 @@ void grpc_subchannel_call_holder_init(
|
|
68
68
|
holder->waiting_ops_capacity = 0;
|
69
69
|
holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
|
70
70
|
holder->owning_call = owning_call;
|
71
|
+
holder->pollent = NULL;
|
71
72
|
}
|
72
73
|
|
73
74
|
void grpc_subchannel_call_holder_destroy(grpc_exec_ctx *exec_ctx,
|
@@ -90,7 +91,8 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
|
|
90
91
|
grpc_subchannel_call *call = GET_CALL(holder);
|
91
92
|
GPR_TIMER_BEGIN("grpc_subchannel_call_holder_perform_op", 0);
|
92
93
|
if (call == CANCELLED_CALL) {
|
93
|
-
grpc_transport_stream_op_finish_with_failure(exec_ctx, op
|
94
|
+
grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
|
95
|
+
GRPC_ERROR_CANCELLED);
|
94
96
|
GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
|
95
97
|
return;
|
96
98
|
}
|
@@ -106,7 +108,8 @@ retry:
|
|
106
108
|
call = GET_CALL(holder);
|
107
109
|
if (call == CANCELLED_CALL) {
|
108
110
|
gpr_mu_unlock(&holder->mu);
|
109
|
-
grpc_transport_stream_op_finish_with_failure(exec_ctx, op
|
111
|
+
grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
|
112
|
+
GRPC_ERROR_CANCELLED);
|
110
113
|
GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
|
111
114
|
return;
|
112
115
|
}
|
@@ -123,7 +126,10 @@ retry:
|
|
123
126
|
} else {
|
124
127
|
switch (holder->creation_phase) {
|
125
128
|
case GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING:
|
126
|
-
fail_locked(exec_ctx, holder
|
129
|
+
fail_locked(exec_ctx, holder,
|
130
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Cancelled"),
|
131
|
+
GRPC_ERROR_INT_GRPC_STATUS,
|
132
|
+
op->cancel_with_status));
|
127
133
|
break;
|
128
134
|
case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL:
|
129
135
|
holder->pick_subchannel(exec_ctx, holder->pick_subchannel_arg, NULL,
|
@@ -131,7 +137,8 @@ retry:
|
|
131
137
|
break;
|
132
138
|
}
|
133
139
|
gpr_mu_unlock(&holder->mu);
|
134
|
-
grpc_transport_stream_op_finish_with_failure(exec_ctx, op
|
140
|
+
grpc_transport_stream_op_finish_with_failure(exec_ctx, op,
|
141
|
+
GRPC_ERROR_CANCELLED);
|
135
142
|
GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
|
136
143
|
return;
|
137
144
|
}
|
@@ -157,7 +164,7 @@ retry:
|
|
157
164
|
gpr_atm_rel_store(
|
158
165
|
&holder->subchannel_call,
|
159
166
|
(gpr_atm)(uintptr_t)grpc_connected_subchannel_create_call(
|
160
|
-
exec_ctx, holder->connected_subchannel, holder->
|
167
|
+
exec_ctx, holder->connected_subchannel, holder->pollent));
|
161
168
|
retry_waiting_locked(exec_ctx, holder);
|
162
169
|
goto retry;
|
163
170
|
}
|
@@ -167,22 +174,28 @@ retry:
|
|
167
174
|
GPR_TIMER_END("grpc_subchannel_call_holder_perform_op", 0);
|
168
175
|
}
|
169
176
|
|
170
|
-
static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg,
|
177
|
+
static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg,
|
178
|
+
grpc_error *error) {
|
171
179
|
grpc_subchannel_call_holder *holder = arg;
|
172
180
|
gpr_mu_lock(&holder->mu);
|
173
181
|
GPR_ASSERT(holder->creation_phase ==
|
174
182
|
GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL);
|
175
183
|
holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
|
176
184
|
if (holder->connected_subchannel == NULL) {
|
177
|
-
|
185
|
+
gpr_atm_no_barrier_store(&holder->subchannel_call, 1);
|
186
|
+
fail_locked(exec_ctx, holder,
|
187
|
+
GRPC_ERROR_CREATE_REFERENCING("Failed to create subchannel",
|
188
|
+
&error, 1));
|
178
189
|
} else if (1 == gpr_atm_acq_load(&holder->subchannel_call)) {
|
179
190
|
/* already cancelled before subchannel became ready */
|
180
|
-
fail_locked(exec_ctx, holder
|
191
|
+
fail_locked(exec_ctx, holder,
|
192
|
+
GRPC_ERROR_CREATE_REFERENCING(
|
193
|
+
"Cancelled before creating subchannel", &error, 1));
|
181
194
|
} else {
|
182
195
|
gpr_atm_rel_store(
|
183
196
|
&holder->subchannel_call,
|
184
197
|
(gpr_atm)(uintptr_t)grpc_connected_subchannel_create_call(
|
185
|
-
exec_ctx, holder->connected_subchannel, holder->
|
198
|
+
exec_ctx, holder->connected_subchannel, holder->pollent));
|
186
199
|
retry_waiting_locked(exec_ctx, holder);
|
187
200
|
}
|
188
201
|
gpr_mu_unlock(&holder->mu);
|
@@ -203,18 +216,18 @@ static void retry_waiting_locked(grpc_exec_ctx *exec_ctx,
|
|
203
216
|
a->call = GET_CALL(holder);
|
204
217
|
if (a->call == CANCELLED_CALL) {
|
205
218
|
gpr_free(a);
|
206
|
-
fail_locked(exec_ctx, holder);
|
219
|
+
fail_locked(exec_ctx, holder, GRPC_ERROR_CANCELLED);
|
207
220
|
return;
|
208
221
|
}
|
209
222
|
holder->waiting_ops = NULL;
|
210
223
|
holder->waiting_ops_count = 0;
|
211
224
|
holder->waiting_ops_capacity = 0;
|
212
225
|
GRPC_SUBCHANNEL_CALL_REF(a->call, "retry_ops");
|
213
|
-
|
214
|
-
|
226
|
+
grpc_exec_ctx_sched(exec_ctx, grpc_closure_create(retry_ops, a),
|
227
|
+
GRPC_ERROR_NONE, NULL);
|
215
228
|
}
|
216
229
|
|
217
|
-
static void retry_ops(grpc_exec_ctx *exec_ctx, void *args,
|
230
|
+
static void retry_ops(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
|
218
231
|
retry_ops_args *a = args;
|
219
232
|
size_t i;
|
220
233
|
for (i = 0; i < a->nops; i++) {
|
@@ -239,13 +252,15 @@ static void add_waiting_locked(grpc_subchannel_call_holder *holder,
|
|
239
252
|
}
|
240
253
|
|
241
254
|
static void fail_locked(grpc_exec_ctx *exec_ctx,
|
242
|
-
grpc_subchannel_call_holder *holder
|
255
|
+
grpc_subchannel_call_holder *holder,
|
256
|
+
grpc_error *error) {
|
243
257
|
size_t i;
|
244
258
|
for (i = 0; i < holder->waiting_ops_count; i++) {
|
245
|
-
grpc_transport_stream_op_finish_with_failure(
|
246
|
-
|
259
|
+
grpc_transport_stream_op_finish_with_failure(
|
260
|
+
exec_ctx, &holder->waiting_ops[i], GRPC_ERROR_REF(error));
|
247
261
|
}
|
248
262
|
holder->waiting_ops_count = 0;
|
263
|
+
GRPC_ERROR_UNREF(error);
|
249
264
|
}
|
250
265
|
|
251
266
|
char *grpc_subchannel_call_holder_get_peer(
|