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
@@ -27,6 +27,7 @@
|
|
27
27
|
#include <grpc/support/log_windows.h>
|
28
28
|
#include <grpc/support/thd.h>
|
29
29
|
|
30
|
+
#include "src/core/lib/debug/stats.h"
|
30
31
|
#include "src/core/lib/iomgr/iocp_windows.h"
|
31
32
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
32
33
|
#include "src/core/lib/iomgr/socket_windows.h"
|
@@ -65,6 +66,7 @@ grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx,
|
|
65
66
|
LPOVERLAPPED overlapped;
|
66
67
|
grpc_winsocket *socket;
|
67
68
|
grpc_winsocket_callback_info *info;
|
69
|
+
GRPC_STATS_INC_SYSCALL_POLL(exec_ctx);
|
68
70
|
success = GetQueuedCompletionStatus(
|
69
71
|
g_iocp, &bytes, &completion_key, &overlapped,
|
70
72
|
deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type)));
|
data/src/core/lib/iomgr/iomgr.c
CHANGED
@@ -50,7 +50,7 @@ void grpc_iomgr_init(grpc_exec_ctx *exec_ctx) {
|
|
50
50
|
grpc_executor_init(exec_ctx);
|
51
51
|
grpc_timer_list_init(gpr_now(GPR_CLOCK_MONOTONIC));
|
52
52
|
g_root_object.next = g_root_object.prev = &g_root_object;
|
53
|
-
g_root_object.name = "root";
|
53
|
+
g_root_object.name = (char *)"root";
|
54
54
|
grpc_network_status_init();
|
55
55
|
grpc_iomgr_platform_init();
|
56
56
|
}
|
@@ -164,13 +164,7 @@ void grpc_iomgr_unregister_object(grpc_iomgr_object *obj) {
|
|
164
164
|
|
165
165
|
bool grpc_iomgr_abort_on_leaks(void) {
|
166
166
|
char *env = gpr_getenv("GRPC_ABORT_ON_LEAKS");
|
167
|
-
|
168
|
-
static const char *truthy[] = {"yes", "Yes", "YES", "true",
|
169
|
-
"True", "TRUE", "1"};
|
170
|
-
bool should_we = false;
|
171
|
-
for (size_t i = 0; i < GPR_ARRAY_SIZE(truthy); i++) {
|
172
|
-
if (0 == strcmp(env, truthy[i])) should_we = true;
|
173
|
-
}
|
167
|
+
bool should_we = gpr_is_true(env);
|
174
168
|
gpr_free(env);
|
175
169
|
return should_we;
|
176
170
|
}
|
@@ -57,12 +57,12 @@ bool grpc_is_epollexclusive_available(void) {
|
|
57
57
|
close(fd);
|
58
58
|
return false;
|
59
59
|
}
|
60
|
-
struct epoll_event ev
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
struct epoll_event ev;
|
61
|
+
/* choose events that should cause an error on
|
62
|
+
EPOLLEXCLUSIVE enabled kernels - specifically the combination of
|
63
|
+
EPOLLONESHOT and EPOLLEXCLUSIVE */
|
64
|
+
ev.events = (uint32_t)(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE | EPOLLONESHOT);
|
65
|
+
ev.data.ptr = NULL;
|
66
66
|
if (epoll_ctl(fd, EPOLL_CTL_ADD, evfd, &ev) != 0) {
|
67
67
|
if (errno != EINVAL) {
|
68
68
|
if (!logged_why_not) {
|
@@ -47,7 +47,8 @@ grpc_error *grpc_load_file(const char *filename, int add_null_terminator,
|
|
47
47
|
/* Converting to size_t on the assumption that it will not fail */
|
48
48
|
contents_size = (size_t)ftell(file);
|
49
49
|
fseek(file, 0, SEEK_SET);
|
50
|
-
contents = gpr_malloc(contents_size +
|
50
|
+
contents = (unsigned char *)gpr_malloc(contents_size +
|
51
|
+
(add_null_terminator ? 1 : 0));
|
51
52
|
bytes_read = fread(contents, 1, contents_size, file);
|
52
53
|
if (bytes_read < contents_size) {
|
53
54
|
error = GRPC_OS_ERROR(errno, "fread");
|
@@ -25,7 +25,7 @@ grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
|
|
25
25
|
grpc_pollset_set *pollset_set) {
|
26
26
|
grpc_polling_entity pollent;
|
27
27
|
pollent.pollent.pollset_set = pollset_set;
|
28
|
-
pollent.tag =
|
28
|
+
pollent.tag = GRPC_POLLS_POLLSET_SET;
|
29
29
|
return pollent;
|
30
30
|
}
|
31
31
|
|
@@ -33,12 +33,12 @@ grpc_polling_entity grpc_polling_entity_create_from_pollset(
|
|
33
33
|
grpc_pollset *pollset) {
|
34
34
|
grpc_polling_entity pollent;
|
35
35
|
pollent.pollent.pollset = pollset;
|
36
|
-
pollent.tag =
|
36
|
+
pollent.tag = GRPC_POLLS_POLLSET;
|
37
37
|
return pollent;
|
38
38
|
}
|
39
39
|
|
40
40
|
grpc_pollset *grpc_polling_entity_pollset(grpc_polling_entity *pollent) {
|
41
|
-
if (pollent->tag ==
|
41
|
+
if (pollent->tag == GRPC_POLLS_POLLSET) {
|
42
42
|
return pollent->pollent.pollset;
|
43
43
|
}
|
44
44
|
return NULL;
|
@@ -46,23 +46,23 @@ grpc_pollset *grpc_polling_entity_pollset(grpc_polling_entity *pollent) {
|
|
46
46
|
|
47
47
|
grpc_pollset_set *grpc_polling_entity_pollset_set(
|
48
48
|
grpc_polling_entity *pollent) {
|
49
|
-
if (pollent->tag ==
|
49
|
+
if (pollent->tag == GRPC_POLLS_POLLSET_SET) {
|
50
50
|
return pollent->pollent.pollset_set;
|
51
51
|
}
|
52
52
|
return NULL;
|
53
53
|
}
|
54
54
|
|
55
55
|
bool grpc_polling_entity_is_empty(const grpc_polling_entity *pollent) {
|
56
|
-
return pollent->tag ==
|
56
|
+
return pollent->tag == GRPC_POLLS_NONE;
|
57
57
|
}
|
58
58
|
|
59
59
|
void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
|
60
60
|
grpc_polling_entity *pollent,
|
61
61
|
grpc_pollset_set *pss_dst) {
|
62
|
-
if (pollent->tag ==
|
62
|
+
if (pollent->tag == GRPC_POLLS_POLLSET) {
|
63
63
|
GPR_ASSERT(pollent->pollent.pollset != NULL);
|
64
64
|
grpc_pollset_set_add_pollset(exec_ctx, pss_dst, pollent->pollent.pollset);
|
65
|
-
} else if (pollent->tag ==
|
65
|
+
} else if (pollent->tag == GRPC_POLLS_POLLSET_SET) {
|
66
66
|
GPR_ASSERT(pollent->pollent.pollset_set != NULL);
|
67
67
|
grpc_pollset_set_add_pollset_set(exec_ctx, pss_dst,
|
68
68
|
pollent->pollent.pollset_set);
|
@@ -75,10 +75,10 @@ void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
|
|
75
75
|
void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx,
|
76
76
|
grpc_polling_entity *pollent,
|
77
77
|
grpc_pollset_set *pss_dst) {
|
78
|
-
if (pollent->tag ==
|
78
|
+
if (pollent->tag == GRPC_POLLS_POLLSET) {
|
79
79
|
GPR_ASSERT(pollent->pollent.pollset != NULL);
|
80
80
|
grpc_pollset_set_del_pollset(exec_ctx, pss_dst, pollent->pollent.pollset);
|
81
|
-
} else if (pollent->tag ==
|
81
|
+
} else if (pollent->tag == GRPC_POLLS_POLLSET_SET) {
|
82
82
|
GPR_ASSERT(pollent->pollent.pollset_set != NULL);
|
83
83
|
grpc_pollset_set_del_pollset_set(exec_ctx, pss_dst,
|
84
84
|
pollent->pollent.pollset_set);
|
@@ -22,6 +22,12 @@
|
|
22
22
|
#include "src/core/lib/iomgr/pollset.h"
|
23
23
|
#include "src/core/lib/iomgr/pollset_set.h"
|
24
24
|
|
25
|
+
typedef enum grpc_pollset_tag {
|
26
|
+
GRPC_POLLS_NONE,
|
27
|
+
GRPC_POLLS_POLLSET,
|
28
|
+
GRPC_POLLS_POLLSET_SET
|
29
|
+
} grpc_pollset_tag;
|
30
|
+
|
25
31
|
/* A grpc_polling_entity is a pollset-or-pollset_set container. It allows
|
26
32
|
* functions that accept a pollset XOR a pollset_set to do so through an
|
27
33
|
* abstract interface. No ownership is taken. */
|
@@ -31,7 +37,7 @@ typedef struct grpc_polling_entity {
|
|
31
37
|
grpc_pollset *pollset;
|
32
38
|
grpc_pollset_set *pollset_set;
|
33
39
|
} pollent;
|
34
|
-
|
40
|
+
grpc_pollset_tag tag;
|
35
41
|
} grpc_polling_entity;
|
36
42
|
|
37
43
|
grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
|
@@ -76,7 +76,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
|
76
76
|
|
77
77
|
/* Break one polling thread out of polling work for this pollset.
|
78
78
|
If specific_worker is non-NULL, then kick that worker. */
|
79
|
-
grpc_error *grpc_pollset_kick(grpc_pollset *pollset,
|
79
|
+
grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
80
80
|
grpc_pollset_worker *specific_worker)
|
81
81
|
GRPC_MUST_USE_RESULT;
|
82
82
|
|
@@ -145,7 +145,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
|
145
145
|
return GRPC_ERROR_NONE;
|
146
146
|
}
|
147
147
|
|
148
|
-
grpc_error *grpc_pollset_kick(grpc_pollset *pollset,
|
148
|
+
grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
149
149
|
grpc_pollset_worker *specific_worker) {
|
150
150
|
GRPC_UV_ASSERT_SAME_THREAD();
|
151
151
|
uv_timer_start(dummy_uv_handle, dummy_timer_cb, 0, 0);
|
@@ -98,7 +98,7 @@ void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
|
|
98
98
|
void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
99
99
|
grpc_closure *closure) {
|
100
100
|
pollset->shutting_down = 1;
|
101
|
-
grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST);
|
101
|
+
grpc_pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST);
|
102
102
|
if (!pollset->is_iocp_worker) {
|
103
103
|
GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE);
|
104
104
|
} else {
|
@@ -181,7 +181,7 @@ done:
|
|
181
181
|
return GRPC_ERROR_NONE;
|
182
182
|
}
|
183
183
|
|
184
|
-
grpc_error *grpc_pollset_kick(grpc_pollset *p,
|
184
|
+
grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p,
|
185
185
|
grpc_pollset_worker *specific_worker) {
|
186
186
|
if (specific_worker != NULL) {
|
187
187
|
if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) {
|
@@ -209,7 +209,7 @@ grpc_error *grpc_pollset_kick(grpc_pollset *p,
|
|
209
209
|
specific_worker =
|
210
210
|
pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET);
|
211
211
|
if (specific_worker != NULL) {
|
212
|
-
grpc_pollset_kick(p, specific_worker);
|
212
|
+
grpc_pollset_kick(exec_ctx, p, specific_worker);
|
213
213
|
} else if (p->is_iocp_worker) {
|
214
214
|
grpc_iocp_kick();
|
215
215
|
} else {
|
data/src/core/lib/iomgr/port.h
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
#define GRPC_HAVE_IP_PKTINFO 1
|
31
31
|
#define GRPC_HAVE_MSG_NOSIGNAL 1
|
32
32
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
33
|
+
#define GRPC_POSIX_FORK 1
|
33
34
|
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
|
34
35
|
#define GRPC_POSIX_SOCKET 1
|
35
36
|
#define GRPC_POSIX_SOCKETADDR 1
|
@@ -59,6 +60,7 @@
|
|
59
60
|
#define GRPC_HAVE_MSG_NOSIGNAL 1
|
60
61
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
61
62
|
#define GRPC_LINUX_MULTIPOLL_WITH_EPOLL 1
|
63
|
+
#define GRPC_POSIX_FORK 1
|
62
64
|
#define GRPC_POSIX_HOST_NAME_MAX 1
|
63
65
|
#define GRPC_POSIX_SOCKET 1
|
64
66
|
#define GRPC_POSIX_SOCKETADDR 1
|
@@ -90,6 +92,7 @@
|
|
90
92
|
#define GRPC_HAVE_SO_NOSIGPIPE 1
|
91
93
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
92
94
|
#define GRPC_MSG_IOVLEN_TYPE int
|
95
|
+
#define GRPC_POSIX_FORK 1
|
93
96
|
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
|
94
97
|
#define GRPC_POSIX_SOCKET 1
|
95
98
|
#define GRPC_POSIX_SOCKETADDR 1
|
@@ -103,6 +106,7 @@
|
|
103
106
|
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
|
104
107
|
#define GRPC_HAVE_SO_NOSIGPIPE 1
|
105
108
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
109
|
+
#define GRPC_POSIX_FORK 1
|
106
110
|
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
|
107
111
|
#define GRPC_POSIX_SOCKET 1
|
108
112
|
#define GRPC_POSIX_SOCKETADDR 1
|
@@ -85,7 +85,7 @@ static grpc_error *blocking_resolve_address_impl(
|
|
85
85
|
|
86
86
|
if (s != 0) {
|
87
87
|
/* Retry if well-known service name is recognized */
|
88
|
-
char *svc[][2] = {{"http", "80"}, {"https", "443"}};
|
88
|
+
const char *svc[][2] = {{"http", "80"}, {"https", "443"}};
|
89
89
|
for (i = 0; i < GPR_ARRAY_SIZE(svc); i++) {
|
90
90
|
if (strcmp(port, svc[i][0]) == 0) {
|
91
91
|
GRPC_SCHEDULING_START_BLOCKING_REGION;
|
@@ -112,13 +112,14 @@ static grpc_error *blocking_resolve_address_impl(
|
|
112
112
|
}
|
113
113
|
|
114
114
|
/* Success path: set addrs non-NULL, fill it in */
|
115
|
-
*addresses =
|
115
|
+
*addresses =
|
116
|
+
(grpc_resolved_addresses *)gpr_malloc(sizeof(grpc_resolved_addresses));
|
116
117
|
(*addresses)->naddrs = 0;
|
117
118
|
for (resp = result; resp != NULL; resp = resp->ai_next) {
|
118
119
|
(*addresses)->naddrs++;
|
119
120
|
}
|
120
|
-
(*addresses)->addrs =
|
121
|
-
|
121
|
+
(*addresses)->addrs = (grpc_resolved_address *)gpr_malloc(
|
122
|
+
sizeof(grpc_resolved_address) * (*addresses)->naddrs);
|
122
123
|
i = 0;
|
123
124
|
for (resp = result; resp != NULL; resp = resp->ai_next) {
|
124
125
|
memcpy(&(*addresses)->addrs[i].addr, resp->ai_addr, resp->ai_addrlen);
|
@@ -153,7 +154,7 @@ typedef struct {
|
|
153
154
|
* grpc_blocking_resolve_address */
|
154
155
|
static void do_request_thread(grpc_exec_ctx *exec_ctx, void *rp,
|
155
156
|
grpc_error *error) {
|
156
|
-
request *r = rp;
|
157
|
+
request *r = (request *)rp;
|
157
158
|
GRPC_CLOSURE_SCHED(
|
158
159
|
exec_ctx, r->on_done,
|
159
160
|
grpc_blocking_resolve_address(r->name, r->default_port, r->addrs_out));
|
@@ -174,9 +175,9 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name,
|
|
174
175
|
grpc_pollset_set *interested_parties,
|
175
176
|
grpc_closure *on_done,
|
176
177
|
grpc_resolved_addresses **addrs) {
|
177
|
-
request *r = gpr_malloc(sizeof(request));
|
178
|
+
request *r = (request *)gpr_malloc(sizeof(request));
|
178
179
|
GRPC_CLOSURE_INIT(&r->request_closure, do_request_thread, r,
|
179
|
-
grpc_executor_scheduler);
|
180
|
+
grpc_executor_scheduler(GRPC_EXECUTOR_SHORT));
|
180
181
|
r->name = gpr_strdup(name);
|
181
182
|
r->default_port = gpr_strdup(default_port);
|
182
183
|
r->on_done = on_done;
|
@@ -159,7 +159,7 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name,
|
|
159
159
|
grpc_resolved_addresses **addresses) {
|
160
160
|
request *r = gpr_malloc(sizeof(request));
|
161
161
|
GRPC_CLOSURE_INIT(&r->request_closure, do_request_thread, r,
|
162
|
-
grpc_executor_scheduler);
|
162
|
+
grpc_executor_scheduler(GRPC_EXECUTOR_SHORT));
|
163
163
|
r->name = gpr_strdup(name);
|
164
164
|
r->default_port = gpr_strdup(default_port);
|
165
165
|
r->on_done = on_done;
|
@@ -22,6 +22,7 @@
|
|
22
22
|
#include <stdint.h>
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include <grpc/slice_buffer.h>
|
25
26
|
#include <grpc/support/alloc.h>
|
26
27
|
#include <grpc/support/log.h>
|
27
28
|
#include <grpc/support/string_util.h>
|
@@ -241,7 +242,7 @@ static bool rq_reclaim(grpc_exec_ctx *exec_ctx,
|
|
241
242
|
grpc_resource_quota *resource_quota, bool destructive);
|
242
243
|
|
243
244
|
static void rq_step(grpc_exec_ctx *exec_ctx, void *rq, grpc_error *error) {
|
244
|
-
grpc_resource_quota *resource_quota = rq;
|
245
|
+
grpc_resource_quota *resource_quota = (grpc_resource_quota *)rq;
|
245
246
|
resource_quota->step_scheduled = false;
|
246
247
|
do {
|
247
248
|
if (rq_alloc(exec_ctx, resource_quota)) goto done;
|
@@ -380,12 +381,12 @@ typedef struct {
|
|
380
381
|
} ru_slice_refcount;
|
381
382
|
|
382
383
|
static void ru_slice_ref(void *p) {
|
383
|
-
ru_slice_refcount *rc = p;
|
384
|
+
ru_slice_refcount *rc = (ru_slice_refcount *)p;
|
384
385
|
gpr_ref(&rc->refs);
|
385
386
|
}
|
386
387
|
|
387
388
|
static void ru_slice_unref(grpc_exec_ctx *exec_ctx, void *p) {
|
388
|
-
ru_slice_refcount *rc = p;
|
389
|
+
ru_slice_refcount *rc = (ru_slice_refcount *)p;
|
389
390
|
if (gpr_unref(&rc->refs)) {
|
390
391
|
grpc_resource_user_free(exec_ctx, rc->resource_user, rc->size);
|
391
392
|
gpr_free(rc);
|
@@ -398,7 +399,8 @@ static const grpc_slice_refcount_vtable ru_slice_vtable = {
|
|
398
399
|
|
399
400
|
static grpc_slice ru_slice_create(grpc_resource_user *resource_user,
|
400
401
|
size_t size) {
|
401
|
-
ru_slice_refcount *rc =
|
402
|
+
ru_slice_refcount *rc =
|
403
|
+
(ru_slice_refcount *)gpr_malloc(sizeof(ru_slice_refcount) + size);
|
402
404
|
rc->base.vtable = &ru_slice_vtable;
|
403
405
|
rc->base.sub_refcount = &rc->base;
|
404
406
|
gpr_ref_init(&rc->refs, 1);
|
@@ -417,7 +419,7 @@ static grpc_slice ru_slice_create(grpc_resource_user *resource_user,
|
|
417
419
|
*/
|
418
420
|
|
419
421
|
static void ru_allocate(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
420
|
-
grpc_resource_user *resource_user = ru;
|
422
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
421
423
|
if (rulist_empty(resource_user->resource_quota,
|
422
424
|
GRPC_RULIST_AWAITING_ALLOCATION)) {
|
423
425
|
rq_step_sched(exec_ctx, resource_user->resource_quota);
|
@@ -427,7 +429,7 @@ static void ru_allocate(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
|
427
429
|
|
428
430
|
static void ru_add_to_free_pool(grpc_exec_ctx *exec_ctx, void *ru,
|
429
431
|
grpc_error *error) {
|
430
|
-
grpc_resource_user *resource_user = ru;
|
432
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
431
433
|
if (!rulist_empty(resource_user->resource_quota,
|
432
434
|
GRPC_RULIST_AWAITING_ALLOCATION) &&
|
433
435
|
rulist_empty(resource_user->resource_quota,
|
@@ -454,7 +456,7 @@ static bool ru_post_reclaimer(grpc_exec_ctx *exec_ctx,
|
|
454
456
|
|
455
457
|
static void ru_post_benign_reclaimer(grpc_exec_ctx *exec_ctx, void *ru,
|
456
458
|
grpc_error *error) {
|
457
|
-
grpc_resource_user *resource_user = ru;
|
459
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
458
460
|
if (!ru_post_reclaimer(exec_ctx, resource_user, false)) return;
|
459
461
|
if (!rulist_empty(resource_user->resource_quota,
|
460
462
|
GRPC_RULIST_AWAITING_ALLOCATION) &&
|
@@ -469,7 +471,7 @@ static void ru_post_benign_reclaimer(grpc_exec_ctx *exec_ctx, void *ru,
|
|
469
471
|
|
470
472
|
static void ru_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *ru,
|
471
473
|
grpc_error *error) {
|
472
|
-
grpc_resource_user *resource_user = ru;
|
474
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
473
475
|
if (!ru_post_reclaimer(exec_ctx, resource_user, true)) return;
|
474
476
|
if (!rulist_empty(resource_user->resource_quota,
|
475
477
|
GRPC_RULIST_AWAITING_ALLOCATION) &&
|
@@ -485,7 +487,7 @@ static void ru_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *ru,
|
|
485
487
|
}
|
486
488
|
|
487
489
|
static void ru_shutdown(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
488
|
-
grpc_resource_user *resource_user = ru;
|
490
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
489
491
|
GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[0],
|
490
492
|
GRPC_ERROR_CANCELLED);
|
491
493
|
GRPC_CLOSURE_SCHED(exec_ctx, resource_user->reclaimers[1],
|
@@ -497,7 +499,7 @@ static void ru_shutdown(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
|
497
499
|
}
|
498
500
|
|
499
501
|
static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
500
|
-
grpc_resource_user *resource_user = ru;
|
502
|
+
grpc_resource_user *resource_user = (grpc_resource_user *)ru;
|
501
503
|
GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->refs) == 0);
|
502
504
|
for (int i = 0; i < GRPC_RULIST_COUNT; i++) {
|
503
505
|
rulist_remove(resource_user, (grpc_rulist)i);
|
@@ -518,7 +520,8 @@ static void ru_destroy(grpc_exec_ctx *exec_ctx, void *ru, grpc_error *error) {
|
|
518
520
|
|
519
521
|
static void ru_allocated_slices(grpc_exec_ctx *exec_ctx, void *arg,
|
520
522
|
grpc_error *error) {
|
521
|
-
grpc_resource_user_slice_allocator *slice_allocator =
|
523
|
+
grpc_resource_user_slice_allocator *slice_allocator =
|
524
|
+
(grpc_resource_user_slice_allocator *)arg;
|
522
525
|
if (error == GRPC_ERROR_NONE) {
|
523
526
|
for (size_t i = 0; i < slice_allocator->count; i++) {
|
524
527
|
grpc_slice_buffer_add_indexed(
|
@@ -541,7 +544,7 @@ typedef struct {
|
|
541
544
|
} rq_resize_args;
|
542
545
|
|
543
546
|
static void rq_resize(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
|
544
|
-
rq_resize_args *a = args;
|
547
|
+
rq_resize_args *a = (rq_resize_args *)args;
|
545
548
|
int64_t delta = a->size - a->resource_quota->size;
|
546
549
|
a->resource_quota->size += delta;
|
547
550
|
a->resource_quota->free_pool += delta;
|
@@ -553,7 +556,7 @@ static void rq_resize(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
|
|
553
556
|
|
554
557
|
static void rq_reclamation_done(grpc_exec_ctx *exec_ctx, void *rq,
|
555
558
|
grpc_error *error) {
|
556
|
-
grpc_resource_quota *resource_quota = rq;
|
559
|
+
grpc_resource_quota *resource_quota = (grpc_resource_quota *)rq;
|
557
560
|
resource_quota->reclaiming = false;
|
558
561
|
rq_step_sched(exec_ctx, resource_quota);
|
559
562
|
grpc_resource_quota_unref_internal(exec_ctx, resource_quota);
|
@@ -565,7 +568,8 @@ static void rq_reclamation_done(grpc_exec_ctx *exec_ctx, void *rq,
|
|
565
568
|
|
566
569
|
/* Public API */
|
567
570
|
grpc_resource_quota *grpc_resource_quota_create(const char *name) {
|
568
|
-
grpc_resource_quota *resource_quota =
|
571
|
+
grpc_resource_quota *resource_quota =
|
572
|
+
(grpc_resource_quota *)gpr_malloc(sizeof(*resource_quota));
|
569
573
|
gpr_ref_init(&resource_quota->refs, 1);
|
570
574
|
resource_quota->combiner = grpc_combiner_create();
|
571
575
|
resource_quota->free_pool = INT64_MAX;
|
@@ -629,7 +633,7 @@ double grpc_resource_quota_get_memory_pressure(
|
|
629
633
|
void grpc_resource_quota_resize(grpc_resource_quota *resource_quota,
|
630
634
|
size_t size) {
|
631
635
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
632
|
-
rq_resize_args *a = gpr_malloc(sizeof(*a));
|
636
|
+
rq_resize_args *a = (rq_resize_args *)gpr_malloc(sizeof(*a));
|
633
637
|
a->resource_quota = grpc_resource_quota_ref_internal(resource_quota);
|
634
638
|
a->size = (int64_t)size;
|
635
639
|
gpr_atm_no_barrier_store(&resource_quota->last_size,
|
@@ -653,7 +657,7 @@ grpc_resource_quota *grpc_resource_quota_from_channel_args(
|
|
653
657
|
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) {
|
654
658
|
if (channel_args->args[i].type == GRPC_ARG_POINTER) {
|
655
659
|
return grpc_resource_quota_ref_internal(
|
656
|
-
channel_args->args[i].value.pointer.p);
|
660
|
+
(grpc_resource_quota *)channel_args->args[i].value.pointer.p);
|
657
661
|
} else {
|
658
662
|
gpr_log(GPR_DEBUG, GRPC_ARG_RESOURCE_QUOTA " should be a pointer");
|
659
663
|
}
|
@@ -663,12 +667,12 @@ grpc_resource_quota *grpc_resource_quota_from_channel_args(
|
|
663
667
|
}
|
664
668
|
|
665
669
|
static void *rq_copy(void *rq) {
|
666
|
-
grpc_resource_quota_ref(rq);
|
670
|
+
grpc_resource_quota_ref((grpc_resource_quota *)rq);
|
667
671
|
return rq;
|
668
672
|
}
|
669
673
|
|
670
674
|
static void rq_destroy(grpc_exec_ctx *exec_ctx, void *rq) {
|
671
|
-
grpc_resource_quota_unref_internal(exec_ctx, rq);
|
675
|
+
grpc_resource_quota_unref_internal(exec_ctx, (grpc_resource_quota *)rq);
|
672
676
|
}
|
673
677
|
|
674
678
|
static int rq_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
|
@@ -684,7 +688,8 @@ const grpc_arg_pointer_vtable *grpc_resource_quota_arg_vtable(void) {
|
|
684
688
|
|
685
689
|
grpc_resource_user *grpc_resource_user_create(
|
686
690
|
grpc_resource_quota *resource_quota, const char *name) {
|
687
|
-
grpc_resource_user *resource_user =
|
691
|
+
grpc_resource_user *resource_user =
|
692
|
+
(grpc_resource_user *)gpr_malloc(sizeof(*resource_user));
|
688
693
|
resource_user->resource_quota =
|
689
694
|
grpc_resource_quota_ref_internal(resource_quota);
|
690
695
|
GRPC_CLOSURE_INIT(&resource_user->allocate_closure, &ru_allocate,
|