grpc 1.6.7 → 1.7.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 +579 -77
- data/include/grpc/byte_buffer.h +1 -63
- data/include/grpc/compression.h +27 -5
- data/include/grpc/fork.h +24 -0
- data/include/grpc/grpc.h +12 -6
- data/include/grpc/grpc_security.h +28 -7
- data/include/grpc/impl/codegen/atm.h +1 -0
- data/include/grpc/impl/codegen/byte_buffer.h +86 -0
- data/include/grpc/impl/codegen/compression_types.h +63 -5
- data/include/grpc/impl/codegen/fork.h +48 -0
- data/include/grpc/impl/codegen/grpc_types.h +26 -9
- data/include/grpc/impl/codegen/port_platform.h +11 -4
- data/include/grpc/impl/codegen/slice.h +6 -1
- data/include/grpc/impl/codegen/sync.h +3 -1
- data/include/grpc/impl/codegen/sync_custom.h +36 -0
- data/include/grpc/module.modulemap +75 -3
- data/include/grpc/slice.h +1 -5
- data/include/grpc/support/sync_custom.h +24 -0
- data/src/core/ext/census/base_resources.c +14 -14
- data/src/core/ext/census/context.c +7 -5
- data/src/core/ext/census/grpc_filter.c +12 -14
- data/src/core/ext/census/mlog.c +2 -1
- data/src/core/ext/census/resource.c +13 -9
- data/src/core/ext/filters/client_channel/channel_connectivity.c +15 -8
- data/src/core/ext/filters/client_channel/client_channel.c +418 -439
- data/src/core/ext/filters/client_channel/client_channel_factory.c +4 -5
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +2 -2
- data/src/core/ext/filters/client_channel/http_connect_handshaker.c +7 -5
- data/src/core/ext/filters/client_channel/http_proxy.c +17 -21
- data/src/core/ext/filters/client_channel/lb_policy.c +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +7 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +371 -257
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +25 -14
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +33 -28
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +10 -8
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +7 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +62 -28
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +29 -23
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +25 -14
- data/src/core/ext/filters/client_channel/retry_throttle.c +9 -6
- data/src/core/ext/filters/client_channel/subchannel.c +30 -30
- data/src/core/ext/filters/client_channel/subchannel.h +1 -4
- data/src/core/ext/filters/client_channel/subchannel_index.c +31 -15
- data/src/core/ext/filters/client_channel/subchannel_index.h +7 -0
- data/src/core/ext/filters/client_channel/uri_parser.c +4 -3
- data/src/core/ext/filters/deadline/deadline_filter.c +78 -39
- data/src/core/ext/filters/deadline/deadline_filter.h +7 -1
- data/src/core/ext/filters/http/client/http_client_filter.c +14 -14
- data/src/core/ext/filters/http/http_filters_plugin.c +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.c +240 -175
- data/src/core/ext/filters/http/server/http_server_filter.c +48 -36
- data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c} +11 -12
- data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h} +6 -5
- data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c} +19 -13
- data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h} +4 -3
- data/src/core/ext/filters/max_age/max_age_filter.c +2 -3
- data/src/core/ext/filters/message_size/message_size_filter.c +4 -2
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +0 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +5 -5
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +20 -18
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +1 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +493 -210
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.c +9 -8
- data/src/core/ext/transport/chttp2/transport/frame_data.c +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +10 -9
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +9 -5
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +62 -41
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +52 -8
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +3 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +60 -30
- data/src/core/ext/transport/chttp2/transport/parsing.c +16 -5
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -16
- data/src/core/ext/transport/chttp2/transport/stream_map.c +6 -4
- data/src/core/ext/transport/chttp2/transport/writing.c +133 -105
- data/src/core/ext/transport/inproc/inproc_transport.c +61 -65
- data/src/core/lib/channel/channel_args.c +112 -12
- data/src/core/lib/channel/channel_args.h +31 -0
- data/src/core/lib/channel/channel_stack.c +1 -15
- data/src/core/lib/channel/channel_stack.h +3 -10
- data/src/core/lib/channel/channel_stack_builder.c +41 -10
- data/src/core/lib/channel/channel_stack_builder.h +10 -0
- data/src/core/lib/channel/connected_channel.c +94 -23
- data/src/core/lib/channel/handshaker.c +8 -6
- data/src/core/lib/channel/handshaker_registry.c +1 -1
- data/src/core/lib/compression/algorithm_metadata.h +14 -0
- data/src/core/lib/compression/compression.c +101 -1
- data/src/core/lib/compression/stream_compression.c +32 -146
- data/src/core/lib/compression/stream_compression.h +28 -4
- data/src/core/lib/compression/stream_compression_gzip.c +228 -0
- data/src/core/lib/{iomgr/ev_epoll_thread_pool_linux.h → compression/stream_compression_gzip.h} +5 -7
- data/src/core/lib/compression/stream_compression_identity.c +94 -0
- data/src/core/lib/{iomgr/ev_epoll_limited_pollers_linux.h → compression/stream_compression_identity.h} +7 -8
- data/src/core/lib/debug/stats.c +174 -0
- data/src/core/lib/debug/stats.h +61 -0
- data/src/core/lib/debug/stats_data.c +687 -0
- data/src/core/lib/debug/stats_data.h +470 -0
- data/src/core/lib/debug/trace.c +3 -3
- data/src/core/lib/debug/trace.h +1 -1
- data/src/core/lib/http/format_request.c +1 -1
- data/src/core/lib/http/httpcli.c +8 -7
- data/src/core/lib/http/httpcli_security_connector.c +2 -1
- data/src/core/lib/http/parser.c +4 -3
- data/src/core/lib/iomgr/call_combiner.c +202 -0
- data/src/core/lib/iomgr/call_combiner.h +121 -0
- data/src/core/lib/iomgr/closure.c +18 -4
- data/src/core/lib/iomgr/combiner.c +11 -4
- data/src/core/lib/iomgr/error.c +26 -24
- data/src/core/lib/iomgr/ev_epoll1_linux.c +395 -212
- data/src/core/lib/iomgr/ev_epollex_linux.c +141 -128
- data/src/core/lib/iomgr/ev_epollsig_linux.c +44 -41
- data/src/core/lib/iomgr/ev_poll_posix.c +99 -75
- data/src/core/lib/iomgr/ev_posix.c +5 -9
- data/src/core/lib/iomgr/ev_posix.h +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +6 -1
- data/src/core/lib/iomgr/executor.c +142 -36
- data/src/core/lib/iomgr/executor.h +6 -1
- data/src/core/lib/iomgr/fork_posix.c +88 -0
- data/src/core/lib/iomgr/fork_windows.c +39 -0
- data/src/core/lib/iomgr/iocp_windows.c +2 -0
- data/src/core/lib/iomgr/iomgr.c +2 -8
- data/src/core/lib/iomgr/is_epollexclusive_available.c +6 -6
- data/src/core/lib/iomgr/load_file.c +2 -1
- data/src/core/lib/iomgr/polling_entity.c +9 -9
- data/src/core/lib/iomgr/polling_entity.h +7 -1
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/port.h +4 -0
- data/src/core/lib/iomgr/resolve_address_posix.c +8 -7
- data/src/core/lib/iomgr/resolve_address_windows.c +1 -1
- data/src/core/lib/iomgr/resource_quota.c +24 -19
- data/src/core/lib/iomgr/socket_factory_posix.c +4 -4
- data/src/core/lib/iomgr/socket_mutator.c +4 -4
- data/src/core/lib/iomgr/socket_utils_windows.c +0 -4
- data/src/core/lib/iomgr/tcp_client_posix.c +5 -4
- data/src/core/lib/iomgr/tcp_posix.c +181 -20
- data/src/core/lib/iomgr/tcp_server_posix.c +8 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +1 -1
- data/src/core/lib/iomgr/timer.h +4 -0
- data/src/core/lib/iomgr/timer_generic.c +138 -3
- data/src/core/lib/iomgr/timer_generic.h +3 -0
- data/src/core/lib/iomgr/timer_heap.c +4 -4
- data/src/core/lib/iomgr/timer_manager.c +2 -2
- data/src/core/lib/iomgr/timer_uv.c +2 -0
- data/src/core/lib/iomgr/udp_server.c +10 -8
- data/src/core/lib/iomgr/unix_sockets_posix.c +4 -2
- data/src/core/lib/iomgr/wakeup_fd_cv.c +9 -8
- data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -2
- data/src/core/lib/json/json.c +1 -1
- data/src/core/lib/json/json_string.c +13 -13
- data/src/core/lib/profiling/timers.h +18 -8
- data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -10
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +11 -6
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +4 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +132 -50
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/transport/client_auth_filter.c +68 -135
- data/src/core/lib/security/transport/secure_endpoint.c +110 -90
- data/src/core/lib/security/transport/secure_endpoint.h +8 -3
- data/src/core/lib/security/transport/security_connector.c +10 -12
- data/src/core/lib/security/transport/security_handshaker.c +45 -24
- data/src/core/lib/security/transport/server_auth_filter.c +71 -20
- data/src/core/lib/slice/b64.c +2 -2
- data/src/core/lib/slice/slice.c +16 -14
- data/src/core/lib/slice/slice_buffer.c +5 -4
- data/src/core/lib/slice/slice_hash_table.c +3 -2
- data/src/core/lib/slice/slice_intern.c +8 -5
- data/src/core/lib/support/block_annotate.h +22 -0
- data/src/core/lib/support/fork.c +62 -0
- data/src/core/lib/support/fork.h +35 -0
- data/src/core/lib/support/log_linux.c +1 -1
- data/src/core/lib/support/string.c +15 -1
- data/src/core/lib/support/string.h +3 -0
- data/src/core/lib/support/thd_internal.h +6 -0
- data/src/core/lib/support/thd_posix.c +56 -0
- data/src/core/lib/support/thd_windows.c +2 -0
- data/src/core/lib/surface/alarm.c +22 -15
- data/src/core/lib/surface/byte_buffer.c +4 -2
- data/src/core/lib/surface/call.c +442 -141
- data/src/core/lib/surface/call.h +6 -6
- data/src/core/lib/surface/call_log_batch.c +1 -1
- data/src/core/lib/surface/call_test_only.h +12 -0
- data/src/core/lib/surface/channel.c +39 -4
- data/src/core/lib/surface/channel_init.c +6 -6
- data/src/core/lib/surface/channel_ping.c +2 -2
- data/src/core/lib/surface/completion_queue.c +56 -57
- data/src/core/lib/surface/init.c +17 -3
- data/src/core/lib/surface/init_secure.c +5 -1
- data/src/core/lib/surface/lame_client.cc +9 -10
- data/src/core/lib/surface/server.c +81 -72
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/byte_stream.c +1 -0
- data/src/core/lib/transport/byte_stream.h +3 -1
- data/src/core/lib/transport/connectivity_state.c +2 -1
- data/src/core/lib/transport/metadata.c +7 -4
- data/src/core/lib/transport/metadata_batch.c +18 -16
- data/src/core/lib/transport/metadata_batch.h +1 -0
- data/src/core/lib/transport/service_config.c +5 -3
- data/src/core/lib/transport/static_metadata.c +395 -614
- data/src/core/lib/transport/static_metadata.h +165 -133
- data/src/core/lib/transport/status_conversion.c +1 -1
- data/src/core/lib/transport/transport.c +20 -20
- data/src/core/lib/transport/transport.h +8 -5
- data/src/core/lib/transport/transport_impl.h +0 -3
- data/src/core/lib/transport/transport_op_string.c +8 -1
- data/src/core/plugin_registry/grpc_plugin_registry.c +4 -4
- data/src/core/tsi/fake_transport_security.c +133 -2
- data/src/core/tsi/fake_transport_security.h +5 -0
- data/src/core/tsi/ssl_transport_security.c +105 -8
- data/src/core/tsi/ssl_transport_security.h +30 -7
- data/src/core/tsi/transport_security.h +8 -2
- data/src/core/tsi/transport_security_grpc.c +20 -13
- data/src/core/tsi/transport_security_grpc.h +13 -9
- data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
- data/src/ruby/ext/grpc/rb_grpc.c +1 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
- data/src/ruby/lib/grpc.rb +1 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
- data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
- data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
- data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
- data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
- data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
- data/src/ruby/spec/channel_connection_spec.rb +1 -34
- data/src/ruby/spec/client_server_spec.rb +188 -82
- data/src/ruby/spec/generic/active_call_spec.rb +65 -11
- data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
- data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
- data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
- data/src/ruby/spec/spec_helper.rb +4 -0
- data/src/ruby/spec/support/helpers.rb +73 -0
- data/src/ruby/spec/support/services.rb +147 -0
- data/third_party/cares/ares_build.h +21 -62
- data/third_party/cares/cares/ares.h +23 -1
- data/third_party/cares/cares/ares__close_sockets.c +2 -2
- data/third_party/cares/cares/ares_create_query.c +3 -3
- data/third_party/cares/cares/ares_expand_name.c +6 -2
- data/third_party/cares/cares/ares_expand_string.c +1 -1
- data/third_party/cares/cares/ares_getnameinfo.c +27 -7
- data/third_party/cares/cares/ares_init.c +407 -39
- data/third_party/cares/cares/ares_library_init.c +10 -0
- data/third_party/cares/cares/ares_library_init.h +2 -1
- data/third_party/cares/cares/ares_nowarn.c +6 -6
- data/third_party/cares/cares/ares_nowarn.h +2 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +6 -1
- data/third_party/cares/cares/ares_private.h +11 -0
- data/third_party/cares/cares/ares_process.c +126 -37
- data/third_party/cares/cares/ares_version.h +2 -2
- data/third_party/cares/cares/ares_writev.c +2 -2
- data/third_party/cares/cares/config-win32.h +8 -34
- data/third_party/cares/cares/inet_net_pton.c +2 -2
- data/third_party/cares/cares/setup_once.h +5 -5
- data/third_party/cares/config_darwin/ares_config.h +98 -196
- data/third_party/cares/config_linux/ares_config.h +103 -203
- metadata +47 -20
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +0 -1957
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +0 -1182
@@ -32,6 +32,8 @@
|
|
32
32
|
#define EXPECTED_CONTENT_TYPE_LENGTH sizeof(EXPECTED_CONTENT_TYPE) - 1
|
33
33
|
|
34
34
|
typedef struct call_data {
|
35
|
+
grpc_call_combiner *call_combiner;
|
36
|
+
|
35
37
|
grpc_linked_mdelem status;
|
36
38
|
grpc_linked_mdelem content_type;
|
37
39
|
|
@@ -81,18 +83,18 @@ static grpc_error *server_filter_outgoing_metadata(grpc_exec_ctx *exec_ctx,
|
|
81
83
|
}
|
82
84
|
|
83
85
|
static void add_error(const char *error_name, grpc_error **cumulative,
|
84
|
-
grpc_error *
|
85
|
-
if (
|
86
|
+
grpc_error *new_err) {
|
87
|
+
if (new_err == GRPC_ERROR_NONE) return;
|
86
88
|
if (*cumulative == GRPC_ERROR_NONE) {
|
87
89
|
*cumulative = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_name);
|
88
90
|
}
|
89
|
-
*cumulative = grpc_error_add_child(*cumulative,
|
91
|
+
*cumulative = grpc_error_add_child(*cumulative, new_err);
|
90
92
|
}
|
91
93
|
|
92
94
|
static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx,
|
93
95
|
grpc_call_element *elem,
|
94
96
|
grpc_metadata_batch *b) {
|
95
|
-
call_data *calld = elem->call_data;
|
97
|
+
call_data *calld = (call_data *)elem->call_data;
|
96
98
|
grpc_error *error = GRPC_ERROR_NONE;
|
97
99
|
static const char *error_name = "Failed processing incoming headers";
|
98
100
|
|
@@ -261,8 +263,8 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx,
|
|
261
263
|
|
262
264
|
static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data,
|
263
265
|
grpc_error *err) {
|
264
|
-
grpc_call_element *elem = user_data;
|
265
|
-
call_data *calld = elem->call_data;
|
266
|
+
grpc_call_element *elem = (grpc_call_element *)user_data;
|
267
|
+
call_data *calld = (call_data *)elem->call_data;
|
266
268
|
if (err == GRPC_ERROR_NONE) {
|
267
269
|
err = server_filter_incoming_metadata(exec_ctx, elem,
|
268
270
|
calld->recv_initial_metadata);
|
@@ -274,14 +276,18 @@ static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
274
276
|
|
275
277
|
static void hs_on_complete(grpc_exec_ctx *exec_ctx, void *user_data,
|
276
278
|
grpc_error *err) {
|
277
|
-
grpc_call_element *elem = user_data;
|
278
|
-
call_data *calld = elem->call_data;
|
279
|
+
grpc_call_element *elem = (grpc_call_element *)user_data;
|
280
|
+
call_data *calld = (call_data *)elem->call_data;
|
279
281
|
/* Call recv_message_ready if we got the payload via the path field */
|
280
282
|
if (calld->seen_path_with_query && calld->recv_message_ready != NULL) {
|
281
283
|
*calld->pp_recv_message = calld->payload_bin_delivered
|
282
284
|
? NULL
|
283
285
|
: (grpc_byte_stream *)&calld->read_stream;
|
284
|
-
|
286
|
+
// Re-enter call combiner for recv_message_ready, since the surface
|
287
|
+
// code will release the call combiner for each callback it receives.
|
288
|
+
GRPC_CALL_COMBINER_START(exec_ctx, calld->call_combiner,
|
289
|
+
calld->recv_message_ready, GRPC_ERROR_REF(err),
|
290
|
+
"resuming recv_message_ready from on_complete");
|
285
291
|
calld->recv_message_ready = NULL;
|
286
292
|
calld->payload_bin_delivered = true;
|
287
293
|
}
|
@@ -290,20 +296,25 @@ static void hs_on_complete(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
290
296
|
|
291
297
|
static void hs_recv_message_ready(grpc_exec_ctx *exec_ctx, void *user_data,
|
292
298
|
grpc_error *err) {
|
293
|
-
grpc_call_element *elem = user_data;
|
294
|
-
call_data *calld = elem->call_data;
|
299
|
+
grpc_call_element *elem = (grpc_call_element *)user_data;
|
300
|
+
call_data *calld = (call_data *)elem->call_data;
|
295
301
|
if (calld->seen_path_with_query) {
|
296
|
-
|
297
|
-
in hs_on_complete callback.
|
302
|
+
// Do nothing. This is probably a GET request, and payload will be
|
303
|
+
// returned in hs_on_complete callback.
|
304
|
+
// Note that we release the call combiner here, so that other
|
305
|
+
// callbacks can run.
|
306
|
+
GRPC_CALL_COMBINER_STOP(exec_ctx, calld->call_combiner,
|
307
|
+
"pausing recv_message_ready until on_complete");
|
298
308
|
} else {
|
299
309
|
GRPC_CLOSURE_RUN(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err));
|
300
310
|
}
|
301
311
|
}
|
302
312
|
|
303
|
-
static
|
304
|
-
|
313
|
+
static grpc_error *hs_mutate_op(grpc_exec_ctx *exec_ctx,
|
314
|
+
grpc_call_element *elem,
|
315
|
+
grpc_transport_stream_op_batch *op) {
|
305
316
|
/* grab pointers to our data from the call element */
|
306
|
-
call_data *calld = elem->call_data;
|
317
|
+
call_data *calld = (call_data *)elem->call_data;
|
307
318
|
|
308
319
|
if (op->send_initial_metadata) {
|
309
320
|
grpc_error *error = GRPC_ERROR_NONE;
|
@@ -323,10 +334,7 @@ static void hs_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
|
323
334
|
server_filter_outgoing_metadata(
|
324
335
|
exec_ctx, elem,
|
325
336
|
op->payload->send_initial_metadata.send_initial_metadata));
|
326
|
-
if (error != GRPC_ERROR_NONE)
|
327
|
-
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error);
|
328
|
-
return;
|
329
|
-
}
|
337
|
+
if (error != GRPC_ERROR_NONE) return error;
|
330
338
|
}
|
331
339
|
|
332
340
|
if (op->recv_initial_metadata) {
|
@@ -359,21 +367,25 @@ static void hs_mutate_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
|
359
367
|
grpc_error *error = server_filter_outgoing_metadata(
|
360
368
|
exec_ctx, elem,
|
361
369
|
op->payload->send_trailing_metadata.send_trailing_metadata);
|
362
|
-
if (error != GRPC_ERROR_NONE)
|
363
|
-
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error);
|
364
|
-
return;
|
365
|
-
}
|
370
|
+
if (error != GRPC_ERROR_NONE) return error;
|
366
371
|
}
|
372
|
+
|
373
|
+
return GRPC_ERROR_NONE;
|
367
374
|
}
|
368
375
|
|
369
|
-
static void
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
GPR_TIMER_BEGIN("
|
374
|
-
hs_mutate_op(exec_ctx, elem, op);
|
375
|
-
|
376
|
-
|
376
|
+
static void hs_start_transport_stream_op_batch(
|
377
|
+
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
378
|
+
grpc_transport_stream_op_batch *op) {
|
379
|
+
call_data *calld = (call_data *)elem->call_data;
|
380
|
+
GPR_TIMER_BEGIN("hs_start_transport_stream_op_batch", 0);
|
381
|
+
grpc_error *error = hs_mutate_op(exec_ctx, elem, op);
|
382
|
+
if (error != GRPC_ERROR_NONE) {
|
383
|
+
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error,
|
384
|
+
calld->call_combiner);
|
385
|
+
} else {
|
386
|
+
grpc_call_next_op(exec_ctx, elem, op);
|
387
|
+
}
|
388
|
+
GPR_TIMER_END("hs_start_transport_stream_op_batch", 0);
|
377
389
|
}
|
378
390
|
|
379
391
|
/* Constructor for call_data */
|
@@ -381,8 +393,9 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
|
381
393
|
grpc_call_element *elem,
|
382
394
|
const grpc_call_element_args *args) {
|
383
395
|
/* grab pointers to our data from the call element */
|
384
|
-
call_data *calld = elem->call_data;
|
396
|
+
call_data *calld = (call_data *)elem->call_data;
|
385
397
|
/* initialize members */
|
398
|
+
calld->call_combiner = args->call_combiner;
|
386
399
|
GRPC_CLOSURE_INIT(&calld->hs_on_recv, hs_on_recv, elem,
|
387
400
|
grpc_schedule_on_exec_ctx);
|
388
401
|
GRPC_CLOSURE_INIT(&calld->hs_on_complete, hs_on_complete, elem,
|
@@ -397,7 +410,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
|
397
410
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
398
411
|
const grpc_call_final_info *final_info,
|
399
412
|
grpc_closure *ignored) {
|
400
|
-
call_data *calld = elem->call_data;
|
413
|
+
call_data *calld = (call_data *)elem->call_data;
|
401
414
|
grpc_slice_buffer_destroy_internal(exec_ctx, &calld->read_slice_buffer);
|
402
415
|
}
|
403
416
|
|
@@ -414,7 +427,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
414
427
|
grpc_channel_element *elem) {}
|
415
428
|
|
416
429
|
const grpc_channel_filter grpc_http_server_filter = {
|
417
|
-
|
430
|
+
hs_start_transport_stream_op_batch,
|
418
431
|
grpc_channel_next_op,
|
419
432
|
sizeof(call_data),
|
420
433
|
init_call_elem,
|
@@ -423,6 +436,5 @@ const grpc_channel_filter grpc_http_server_filter = {
|
|
423
436
|
sizeof(channel_data),
|
424
437
|
init_channel_elem,
|
425
438
|
destroy_channel_elem,
|
426
|
-
grpc_call_next_get_peer,
|
427
439
|
grpc_channel_next_get_info,
|
428
440
|
"http-server"};
|
data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c}
RENAMED
@@ -24,8 +24,8 @@
|
|
24
24
|
#include <grpc/support/string_util.h>
|
25
25
|
#include <grpc/support/sync.h>
|
26
26
|
|
27
|
-
#include "src/core/ext/filters/load_reporting/
|
28
|
-
#include "src/core/ext/filters/load_reporting/
|
27
|
+
#include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
|
28
|
+
#include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h"
|
29
29
|
#include "src/core/lib/channel/channel_args.h"
|
30
30
|
#include "src/core/lib/profiling/timers.h"
|
31
31
|
#include "src/core/lib/slice/slice_internal.h"
|
@@ -56,8 +56,8 @@ typedef struct channel_data {
|
|
56
56
|
|
57
57
|
static void on_initial_md_ready(grpc_exec_ctx *exec_ctx, void *user_data,
|
58
58
|
grpc_error *err) {
|
59
|
-
grpc_call_element *elem = user_data;
|
60
|
-
call_data *calld = elem->call_data;
|
59
|
+
grpc_call_element *elem = (grpc_call_element *)user_data;
|
60
|
+
call_data *calld = (call_data *)elem->call_data;
|
61
61
|
|
62
62
|
if (err == GRPC_ERROR_NONE) {
|
63
63
|
if (calld->recv_initial_metadata->idx.named.path != NULL) {
|
@@ -88,7 +88,7 @@ static void on_initial_md_ready(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
88
88
|
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
89
89
|
grpc_call_element *elem,
|
90
90
|
const grpc_call_element_args *args) {
|
91
|
-
call_data *calld = elem->call_data;
|
91
|
+
call_data *calld = (call_data *)elem->call_data;
|
92
92
|
calld->id = (intptr_t)args->call_stack;
|
93
93
|
GRPC_CLOSURE_INIT(&calld->on_initial_md_ready, on_initial_md_ready, elem,
|
94
94
|
grpc_schedule_on_exec_ctx);
|
@@ -111,7 +111,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
|
111
111
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
112
112
|
const grpc_call_final_info *final_info,
|
113
113
|
grpc_closure *ignored) {
|
114
|
-
call_data *calld = elem->call_data;
|
114
|
+
call_data *calld = (call_data *)elem->call_data;
|
115
115
|
|
116
116
|
/* TODO(dgq): do something with the data
|
117
117
|
channel_data *chand = elem->channel_data;
|
@@ -141,7 +141,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
141
141
|
grpc_channel_element_args *args) {
|
142
142
|
GPR_ASSERT(!args->is_last);
|
143
143
|
|
144
|
-
channel_data *chand = elem->channel_data;
|
144
|
+
channel_data *chand = (channel_data *)elem->channel_data;
|
145
145
|
chand->id = (intptr_t)args->channel_stack;
|
146
146
|
|
147
147
|
/* TODO(dgq): do something with the data
|
@@ -176,8 +176,8 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
176
176
|
static grpc_filtered_mdelem lr_trailing_md_filter(grpc_exec_ctx *exec_ctx,
|
177
177
|
void *user_data,
|
178
178
|
grpc_mdelem md) {
|
179
|
-
grpc_call_element *elem = user_data;
|
180
|
-
call_data *calld = elem->call_data;
|
179
|
+
grpc_call_element *elem = (grpc_call_element *)user_data;
|
180
|
+
call_data *calld = (call_data *)elem->call_data;
|
181
181
|
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_COST_BIN)) {
|
182
182
|
calld->trailing_md_string = GRPC_MDVALUE(md);
|
183
183
|
return GRPC_FILTERED_REMOVE();
|
@@ -189,7 +189,7 @@ static void lr_start_transport_stream_op_batch(
|
|
189
189
|
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
190
190
|
grpc_transport_stream_op_batch *op) {
|
191
191
|
GPR_TIMER_BEGIN("lr_start_transport_stream_op_batch", 0);
|
192
|
-
call_data *calld = elem->call_data;
|
192
|
+
call_data *calld = (call_data *)elem->call_data;
|
193
193
|
|
194
194
|
if (op->recv_initial_metadata) {
|
195
195
|
/* substitute our callback for the higher callback */
|
@@ -213,7 +213,7 @@ static void lr_start_transport_stream_op_batch(
|
|
213
213
|
GPR_TIMER_END("lr_start_transport_stream_op_batch", 0);
|
214
214
|
}
|
215
215
|
|
216
|
-
const grpc_channel_filter
|
216
|
+
const grpc_channel_filter grpc_server_load_reporting_filter = {
|
217
217
|
lr_start_transport_stream_op_batch,
|
218
218
|
grpc_channel_next_op,
|
219
219
|
sizeof(call_data),
|
@@ -223,6 +223,5 @@ const grpc_channel_filter grpc_load_reporting_filter = {
|
|
223
223
|
sizeof(channel_data),
|
224
224
|
init_channel_elem,
|
225
225
|
destroy_channel_elem,
|
226
|
-
grpc_call_next_get_peer,
|
227
226
|
grpc_channel_next_get_info,
|
228
227
|
"load_reporting"};
|
data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h}
RENAMED
@@ -16,12 +16,13 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
#ifndef
|
20
|
-
#define
|
19
|
+
#ifndef GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_FILTER_H
|
20
|
+
#define GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_FILTER_H
|
21
21
|
|
22
|
-
#include "src/core/ext/filters/load_reporting/
|
22
|
+
#include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h"
|
23
23
|
#include "src/core/lib/channel/channel_stack.h"
|
24
24
|
|
25
|
-
extern const grpc_channel_filter
|
25
|
+
extern const grpc_channel_filter grpc_server_load_reporting_filter;
|
26
26
|
|
27
|
-
#endif /*
|
27
|
+
#endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_FILTER_H \
|
28
|
+
*/
|
data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c}
RENAMED
@@ -25,8 +25,8 @@
|
|
25
25
|
#include <grpc/support/alloc.h>
|
26
26
|
#include <grpc/support/sync.h>
|
27
27
|
|
28
|
-
#include "src/core/ext/filters/load_reporting/
|
29
|
-
#include "src/core/ext/filters/load_reporting/
|
28
|
+
#include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
|
29
|
+
#include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h"
|
30
30
|
#include "src/core/lib/channel/channel_stack_builder.h"
|
31
31
|
#include "src/core/lib/slice/slice_internal.h"
|
32
32
|
#include "src/core/lib/surface/call.h"
|
@@ -37,28 +37,34 @@ static bool is_load_reporting_enabled(const grpc_channel_args *a) {
|
|
37
37
|
grpc_channel_args_find(a, GRPC_ARG_ENABLE_LOAD_REPORTING), false);
|
38
38
|
}
|
39
39
|
|
40
|
-
static bool
|
41
|
-
|
42
|
-
void *arg) {
|
40
|
+
static bool maybe_add_server_load_reporting_filter(
|
41
|
+
grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder, void *arg) {
|
43
42
|
const grpc_channel_args *args =
|
44
43
|
grpc_channel_stack_builder_get_channel_arguments(builder);
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
const grpc_channel_filter *filter = (const grpc_channel_filter *)arg;
|
45
|
+
grpc_channel_stack_builder_iterator *it =
|
46
|
+
grpc_channel_stack_builder_iterator_find(builder, filter->name);
|
47
|
+
const bool already_has_load_reporting_filter =
|
48
|
+
!grpc_channel_stack_builder_iterator_is_end(it);
|
49
|
+
grpc_channel_stack_builder_iterator_destroy(it);
|
50
|
+
if (is_load_reporting_enabled(args) && !already_has_load_reporting_filter) {
|
51
|
+
return grpc_channel_stack_builder_prepend_filter(builder, filter, NULL,
|
52
|
+
NULL);
|
48
53
|
}
|
49
54
|
return true;
|
50
55
|
}
|
51
56
|
|
52
57
|
grpc_arg grpc_load_reporting_enable_arg() {
|
53
|
-
return grpc_channel_arg_integer_create(GRPC_ARG_ENABLE_LOAD_REPORTING,
|
58
|
+
return grpc_channel_arg_integer_create((char *)GRPC_ARG_ENABLE_LOAD_REPORTING,
|
59
|
+
1);
|
54
60
|
}
|
55
61
|
|
56
62
|
/* Plugin registration */
|
57
63
|
|
58
|
-
void
|
64
|
+
void grpc_server_load_reporting_plugin_init(void) {
|
59
65
|
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
|
60
|
-
|
61
|
-
(void *)&
|
66
|
+
maybe_add_server_load_reporting_filter,
|
67
|
+
(void *)&grpc_server_load_reporting_filter);
|
62
68
|
}
|
63
69
|
|
64
|
-
void
|
70
|
+
void grpc_server_load_reporting_plugin_shutdown() {}
|
data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h}
RENAMED
@@ -16,8 +16,8 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
#ifndef
|
20
|
-
#define
|
19
|
+
#ifndef GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_PLUGIN_H
|
20
|
+
#define GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_PLUGIN_H
|
21
21
|
|
22
22
|
#include <grpc/impl/codegen/grpc_types.h>
|
23
23
|
|
@@ -55,4 +55,5 @@ typedef struct grpc_load_reporting_call_data {
|
|
55
55
|
/** Return a \a grpc_arg enabling load reporting */
|
56
56
|
grpc_arg grpc_load_reporting_enable_arg();
|
57
57
|
|
58
|
-
#endif /*
|
58
|
+
#endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_PLUGIN_H \
|
59
|
+
*/
|
@@ -273,7 +273,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
|
|
273
273
|
static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
274
274
|
const grpc_call_final_info* final_info,
|
275
275
|
grpc_closure* ignored) {
|
276
|
-
channel_data* chand = elem->channel_data;
|
276
|
+
channel_data* chand = (channel_data*)elem->channel_data;
|
277
277
|
decrease_call_count(exec_ctx, chand);
|
278
278
|
}
|
279
279
|
|
@@ -391,7 +391,6 @@ const grpc_channel_filter grpc_max_age_filter = {
|
|
391
391
|
sizeof(channel_data),
|
392
392
|
init_channel_elem,
|
393
393
|
destroy_channel_elem,
|
394
|
-
grpc_call_next_get_peer,
|
395
394
|
grpc_channel_next_get_info,
|
396
395
|
"max_age"};
|
397
396
|
|
@@ -403,7 +402,7 @@ static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx,
|
|
403
402
|
bool enable =
|
404
403
|
grpc_channel_arg_get_integer(
|
405
404
|
grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_AGE_MS),
|
406
|
-
MAX_CONNECTION_AGE_INTEGER_OPTIONS) != INT_MAX
|
405
|
+
MAX_CONNECTION_AGE_INTEGER_OPTIONS) != INT_MAX ||
|
407
406
|
grpc_channel_arg_get_integer(
|
408
407
|
grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_IDLE_MS),
|
409
408
|
MAX_CONNECTION_IDLE_INTEGER_OPTIONS) != INT_MAX;
|
@@ -68,6 +68,7 @@ static void* message_size_limits_create_from_json(const grpc_json* json) {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
typedef struct call_data {
|
71
|
+
grpc_call_combiner* call_combiner;
|
71
72
|
message_size_limits limits;
|
72
73
|
// Receive closures are chained: we inject this closure as the
|
73
74
|
// recv_message_ready up-call on transport_stream_op, and remember to
|
@@ -131,7 +132,8 @@ static void start_transport_stream_op_batch(
|
|
131
132
|
exec_ctx, op,
|
132
133
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string),
|
133
134
|
GRPC_ERROR_INT_GRPC_STATUS,
|
134
|
-
GRPC_STATUS_RESOURCE_EXHAUSTED)
|
135
|
+
GRPC_STATUS_RESOURCE_EXHAUSTED),
|
136
|
+
calld->call_combiner);
|
135
137
|
gpr_free(message_string);
|
136
138
|
return;
|
137
139
|
}
|
@@ -152,6 +154,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
|
|
152
154
|
const grpc_call_element_args* args) {
|
153
155
|
channel_data* chand = (channel_data*)elem->channel_data;
|
154
156
|
call_data* calld = (call_data*)elem->call_data;
|
157
|
+
calld->call_combiner = args->call_combiner;
|
155
158
|
calld->next_recv_message_ready = NULL;
|
156
159
|
GRPC_CLOSURE_INIT(&calld->recv_message_ready, recv_message_ready, elem,
|
157
160
|
grpc_schedule_on_exec_ctx);
|
@@ -259,7 +262,6 @@ const grpc_channel_filter grpc_message_size_filter = {
|
|
259
262
|
sizeof(channel_data),
|
260
263
|
init_channel_elem,
|
261
264
|
destroy_channel_elem,
|
262
|
-
grpc_call_next_get_peer,
|
263
265
|
grpc_channel_next_get_info,
|
264
266
|
"message_size"};
|
265
267
|
|
@@ -93,8 +93,8 @@ static void chttp2_connector_shutdown(grpc_exec_ctx *exec_ctx,
|
|
93
93
|
|
94
94
|
static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
95
95
|
grpc_error *error) {
|
96
|
-
grpc_handshaker_args *args = arg;
|
97
|
-
chttp2_connector *c = args->user_data;
|
96
|
+
grpc_handshaker_args *args = (grpc_handshaker_args *)arg;
|
97
|
+
chttp2_connector *c = (chttp2_connector *)args->user_data;
|
98
98
|
gpr_mu_lock(&c->mu);
|
99
99
|
if (error != GRPC_ERROR_NONE || c->shutdown) {
|
100
100
|
if (error == GRPC_ERROR_NONE) {
|
@@ -143,7 +143,7 @@ static void start_handshake_locked(grpc_exec_ctx *exec_ctx,
|
|
143
143
|
}
|
144
144
|
|
145
145
|
static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
146
|
-
chttp2_connector *c = arg;
|
146
|
+
chttp2_connector *c = (chttp2_connector *)arg;
|
147
147
|
gpr_mu_lock(&c->mu);
|
148
148
|
GPR_ASSERT(c->connecting);
|
149
149
|
c->connecting = false;
|
@@ -161,7 +161,7 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|
161
161
|
grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(error));
|
162
162
|
}
|
163
163
|
gpr_mu_unlock(&c->mu);
|
164
|
-
chttp2_connector_unref(exec_ctx, arg);
|
164
|
+
chttp2_connector_unref(exec_ctx, (grpc_connector *)arg);
|
165
165
|
} else {
|
166
166
|
GPR_ASSERT(c->endpoint != NULL);
|
167
167
|
start_handshake_locked(exec_ctx, c);
|
@@ -198,7 +198,7 @@ static const grpc_connector_vtable chttp2_connector_vtable = {
|
|
198
198
|
chttp2_connector_connect};
|
199
199
|
|
200
200
|
grpc_connector *grpc_chttp2_connector_create() {
|
201
|
-
chttp2_connector *c = gpr_zalloc(sizeof(*c));
|
201
|
+
chttp2_connector *c = (chttp2_connector *)gpr_zalloc(sizeof(*c));
|
202
202
|
c->base.vtable = &chttp2_connector_vtable;
|
203
203
|
gpr_mu_init(&c->mu);
|
204
204
|
gpr_ref_init(&c->refs, 1);
|