grpc 1.3.4 → 1.4.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 +581 -450
- data/include/grpc/census.h +49 -49
- data/include/grpc/grpc.h +16 -70
- data/include/grpc/grpc_security.h +59 -59
- data/include/grpc/grpc_security_constants.h +9 -9
- data/include/grpc/impl/codegen/atm.h +1 -1
- data/include/grpc/impl/codegen/atm_windows.h +4 -4
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/compression_types.h +4 -5
- data/include/grpc/impl/codegen/gpr_slice.h +5 -5
- data/include/grpc/impl/codegen/gpr_types.h +6 -7
- data/include/grpc/impl/codegen/grpc_types.h +128 -59
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/propagation_bits.h +2 -2
- data/include/grpc/impl/codegen/slice.h +13 -12
- data/include/grpc/impl/codegen/status.h +23 -18
- data/include/grpc/impl/codegen/sync.h +1 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +47 -25
- data/include/grpc/slice_buffer.h +18 -14
- data/include/grpc/support/alloc.h +7 -7
- data/include/grpc/support/cmdline.h +10 -10
- data/include/grpc/support/cpu.h +3 -3
- data/include/grpc/support/histogram.h +1 -1
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +3 -3
- data/include/grpc/support/sync.h +31 -31
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +12 -12
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +2 -2
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/include/grpc/support/useful.h +2 -2
- data/include/grpc/support/workaround_list.h +46 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/intrusive_hash_map.c +319 -0
- data/src/core/ext/census/intrusive_hash_map.h +167 -0
- data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +173 -103
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +90 -59
- data/src/core/ext/filters/client_channel/parse_address.h +17 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +20 -17
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
- data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +30 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +9 -11
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/ev_windows.c +43 -0
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- 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/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +45 -57
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/security/transport/security_handshaker.c +123 -97
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/cmdline.c +3 -3
- data/src/core/lib/support/histogram.c +2 -2
- data/src/core/lib/support/host_port.c +1 -1
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +36 -2
- data/src/core/lib/support/mpscq.h +28 -1
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/string.c +12 -12
- data/src/core/lib/support/string_posix.c +1 -1
- data/src/core/lib/support/subprocess_posix.c +2 -2
- data/src/core/lib/support/thd_posix.c +1 -1
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +694 -247
- data/src/core/lib/surface/completion_queue.h +30 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +79 -110
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +25 -9
- data/src/core/lib/transport/bdp_estimator.h +7 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/config_linux/ares_config.h +36 -2
- data/third_party/zlib/adler32.c +14 -7
- data/third_party/zlib/compress.c +24 -18
- data/third_party/zlib/crc32.c +29 -12
- data/third_party/zlib/deflate.c +499 -303
- data/third_party/zlib/deflate.h +19 -16
- data/third_party/zlib/gzguts.h +16 -7
- data/third_party/zlib/gzlib.c +17 -14
- data/third_party/zlib/gzread.c +108 -48
- data/third_party/zlib/gzwrite.c +210 -122
- data/third_party/zlib/infback.c +2 -2
- data/third_party/zlib/inffast.c +34 -51
- data/third_party/zlib/inflate.c +86 -37
- data/third_party/zlib/inflate.h +7 -4
- data/third_party/zlib/inftrees.c +12 -14
- data/third_party/zlib/trees.c +38 -61
- data/third_party/zlib/uncompr.c +66 -32
- data/third_party/zlib/zconf.h +32 -9
- data/third_party/zlib/zlib.h +298 -154
- data/third_party/zlib/zutil.c +25 -24
- data/third_party/zlib/zutil.h +35 -17
- metadata +63 -30
data/src/ruby/ext/grpc/rb_call.h
CHANGED
@@ -39,13 +39,13 @@
|
|
39
39
|
#include <grpc/grpc.h>
|
40
40
|
|
41
41
|
/* Gets the wrapped call from a VALUE. */
|
42
|
-
grpc_call*
|
42
|
+
grpc_call *grpc_rb_get_wrapped_call(VALUE v);
|
43
43
|
|
44
44
|
/* Gets the VALUE corresponding to given grpc_call. */
|
45
45
|
VALUE grpc_rb_wrap_call(grpc_call *c, grpc_completion_queue *q);
|
46
46
|
|
47
47
|
/* Provides the details of an call error */
|
48
|
-
const char*
|
48
|
+
const char *grpc_call_error_detail_of(grpc_call_error err);
|
49
49
|
|
50
50
|
/* Converts a metadata array to a hash. */
|
51
51
|
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary);
|
@@ -53,8 +53,7 @@ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary);
|
|
53
53
|
/* grpc_rb_md_ary_convert converts a ruby metadata hash into
|
54
54
|
a grpc_metadata_array.
|
55
55
|
*/
|
56
|
-
void grpc_rb_md_ary_convert(VALUE md_ary_hash,
|
57
|
-
grpc_metadata_array *md_ary);
|
56
|
+
void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array *md_ary);
|
58
57
|
|
59
58
|
/* grpc_rb_eCallError is the ruby class of the exception thrown during call
|
60
59
|
operations. */
|
@@ -33,8 +33,8 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
36
|
#include "rb_call_credentials.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
38
|
|
39
39
|
#include <ruby/thread.h>
|
40
40
|
|
@@ -82,20 +82,18 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
|
|
82
82
|
static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
|
83
83
|
VALUE exception_object) {
|
84
84
|
VALUE result = rb_hash_new();
|
85
|
-
VALUE backtrace =
|
86
|
-
rb_funcall(exception_object, rb_intern("backtrace"), 0),
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
VALUE backtrace =
|
86
|
+
rb_funcall(rb_funcall(exception_object, rb_intern("backtrace"), 0),
|
87
|
+
rb_intern("join"), 1, rb_str_new2("\n\tfrom "));
|
88
|
+
VALUE rb_exception_info =
|
89
|
+
rb_funcall(exception_object, rb_intern("inspect"), 0);
|
90
90
|
(void)args;
|
91
91
|
gpr_log(GPR_INFO, "Call credentials callback failed: %s\n%s",
|
92
|
-
StringValueCStr(rb_exception_info),
|
93
|
-
StringValueCStr(backtrace));
|
92
|
+
StringValueCStr(rb_exception_info), StringValueCStr(backtrace));
|
94
93
|
rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
|
95
94
|
rb_hash_aset(result, rb_str_new2("status"),
|
96
95
|
INT2NUM(GRPC_STATUS_UNAUTHENTICATED));
|
97
|
-
rb_hash_aset(result, rb_str_new2("details"),
|
98
|
-
rb_exception_info);
|
96
|
+
rb_hash_aset(result, rb_str_new2("details"), rb_exception_info);
|
99
97
|
return result;
|
100
98
|
}
|
101
99
|
|
@@ -118,7 +116,8 @@ static void grpc_rb_call_credentials_callback_with_gil(void *param) {
|
|
118
116
|
result = rb_rescue(grpc_rb_call_credentials_callback, callback_args,
|
119
117
|
grpc_rb_call_credentials_callback_rescue, Qnil);
|
120
118
|
// Both callbacks return a hash, so result should be a hash
|
121
|
-
grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")),
|
119
|
+
grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")),
|
120
|
+
&md_ary);
|
122
121
|
status = NUM2INT(rb_hash_aref(result, rb_str_new2("status")));
|
123
122
|
details = rb_hash_aref(result, rb_str_new2("details"));
|
124
123
|
error_details = StringValueCStr(details);
|
@@ -138,7 +137,7 @@ static void grpc_rb_call_credentials_plugin_get_metadata(
|
|
138
137
|
params->callback = cb;
|
139
138
|
|
140
139
|
grpc_rb_event_queue_enqueue(grpc_rb_call_credentials_callback_with_gil,
|
141
|
-
(void*)(params));
|
140
|
+
(void *)(params));
|
142
141
|
}
|
143
142
|
|
144
143
|
static void grpc_rb_call_credentials_plugin_destroy(void *state) {
|
@@ -172,13 +171,15 @@ static void grpc_rb_call_credentials_mark(void *p) {
|
|
172
171
|
}
|
173
172
|
|
174
173
|
static rb_data_type_t grpc_rb_call_credentials_data_type = {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
174
|
+
"grpc_call_credentials",
|
175
|
+
{grpc_rb_call_credentials_mark,
|
176
|
+
grpc_rb_call_credentials_free,
|
177
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
178
|
+
{NULL, NULL}},
|
179
|
+
NULL,
|
180
|
+
NULL,
|
180
181
|
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
181
|
-
|
182
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
182
183
|
#endif
|
183
184
|
};
|
184
185
|
|
@@ -188,7 +189,8 @@ static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
|
|
188
189
|
grpc_rb_call_credentials *wrapper = ALLOC(grpc_rb_call_credentials);
|
189
190
|
wrapper->wrapped = NULL;
|
190
191
|
wrapper->mark = Qnil;
|
191
|
-
return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type,
|
192
|
+
return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type,
|
193
|
+
wrapper);
|
192
194
|
}
|
193
195
|
|
194
196
|
/* Creates a wrapping object for a given call credentials. This should only be
|
@@ -232,7 +234,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
|
|
232
234
|
rb_raise(rb_eTypeError, "Argument to CallCredentials#new must be a proc");
|
233
235
|
return Qnil;
|
234
236
|
}
|
235
|
-
plugin.state = (void*)proc;
|
237
|
+
plugin.state = (void *)proc;
|
236
238
|
plugin.type = "";
|
237
239
|
|
238
240
|
creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL);
|
@@ -289,7 +291,6 @@ void Init_grpc_call_credentials() {
|
|
289
291
|
grpc_call_credentials *grpc_rb_get_wrapped_call_credentials(VALUE v) {
|
290
292
|
grpc_rb_call_credentials *wrapper = NULL;
|
291
293
|
TypedData_Get_Struct(v, grpc_rb_call_credentials,
|
292
|
-
&grpc_rb_call_credentials_data_type,
|
293
|
-
wrapper);
|
294
|
+
&grpc_rb_call_credentials_data_type, wrapper);
|
294
295
|
return wrapper->wrapped;
|
295
296
|
}
|
@@ -365,7 +365,6 @@ static void *wait_for_watch_state_op_complete_without_gvl(void *arg) {
|
|
365
365
|
|
366
366
|
return success;
|
367
367
|
}
|
368
|
-
|
369
368
|
static void wait_for_watch_state_op_complete_unblocking_func(void *arg) {
|
370
369
|
bg_watched_channel *bg = (bg_watched_channel *)arg;
|
371
370
|
gpr_mu_lock(&global_connection_polling_mu);
|
@@ -443,7 +442,7 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, VALUE mask,
|
|
443
442
|
parent_call = grpc_rb_get_wrapped_call(parent);
|
444
443
|
}
|
445
444
|
|
446
|
-
cq =
|
445
|
+
cq = grpc_completion_queue_create_for_pluck(NULL);
|
447
446
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
448
447
|
if (wrapper->bg_wrapped == NULL) {
|
449
448
|
rb_raise(rb_eRuntimeError, "closed!");
|
@@ -756,7 +755,7 @@ void grpc_rb_channel_polling_thread_start() {
|
|
756
755
|
gpr_mu_init(&global_connection_polling_mu);
|
757
756
|
gpr_cv_init(&global_connection_polling_cv);
|
758
757
|
|
759
|
-
channel_polling_cq =
|
758
|
+
channel_polling_cq = grpc_completion_queue_create_for_next(NULL);
|
760
759
|
background_thread = rb_thread_create(run_poll_channels_loop, NULL);
|
761
760
|
|
762
761
|
if (!RTEST(background_thread)) {
|
@@ -33,8 +33,8 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
36
|
#include "rb_channel_args.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
38
|
|
39
39
|
#include <grpc/grpc.h>
|
40
40
|
|
@@ -42,9 +42,12 @@
|
|
42
42
|
|
43
43
|
static rb_data_type_t grpc_rb_channel_args_data_type = {
|
44
44
|
"grpc_channel_args",
|
45
|
-
{GRPC_RB_GC_NOT_MARKED,
|
45
|
+
{GRPC_RB_GC_NOT_MARKED,
|
46
|
+
GRPC_RB_GC_DONT_FREE,
|
47
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
46
48
|
{NULL, NULL}},
|
47
|
-
NULL,
|
49
|
+
NULL,
|
50
|
+
NULL,
|
48
51
|
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
49
52
|
RUBY_TYPED_FREE_IMMEDIATELY
|
50
53
|
#endif
|
@@ -137,11 +140,10 @@ static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) {
|
|
137
140
|
params->dst->num_args = num_args;
|
138
141
|
params->dst->args = ALLOC_N(grpc_arg, num_args);
|
139
142
|
MEMZERO(params->dst->args, grpc_arg, num_args);
|
140
|
-
rb_hash_foreach(
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
params->dst));
|
143
|
+
rb_hash_foreach(
|
144
|
+
params->src_hash, grpc_rb_channel_create_in_process_add_args_hash_cb,
|
145
|
+
TypedData_Wrap_Struct(grpc_rb_cChannelArgs,
|
146
|
+
&grpc_rb_channel_args_data_type, params->dst));
|
145
147
|
/* reset num_args as grpc_rb_channel_create_in_process_add_args_hash_cb
|
146
148
|
* decrements it during has processing */
|
147
149
|
params->dst->num_args = num_args;
|
@@ -157,7 +159,7 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash,
|
|
157
159
|
/* Make a protected call to grpc_rb_hash_convert_channel_args */
|
158
160
|
params.src_hash = src_hash;
|
159
161
|
params.dst = dst;
|
160
|
-
rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE)
|
162
|
+
rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE)¶ms, &status);
|
161
163
|
if (status != 0) {
|
162
164
|
if (dst->args != NULL) {
|
163
165
|
/* Free any allocated memory before propagating the error */
|
@@ -35,8 +35,8 @@
|
|
35
35
|
|
36
36
|
#include <string.h>
|
37
37
|
|
38
|
-
#include "rb_grpc_imports.generated.h"
|
39
38
|
#include "rb_channel_credentials.h"
|
39
|
+
#include "rb_grpc_imports.generated.h"
|
40
40
|
|
41
41
|
#include <grpc/grpc.h>
|
42
42
|
#include <grpc/grpc_security.h>
|
@@ -91,8 +91,10 @@ static void grpc_rb_channel_credentials_mark(void *p) {
|
|
91
91
|
|
92
92
|
static rb_data_type_t grpc_rb_channel_credentials_data_type = {
|
93
93
|
"grpc_channel_credentials",
|
94
|
-
{grpc_rb_channel_credentials_mark,
|
95
|
-
|
94
|
+
{grpc_rb_channel_credentials_mark,
|
95
|
+
grpc_rb_channel_credentials_free,
|
96
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
97
|
+
{NULL, NULL}},
|
96
98
|
NULL,
|
97
99
|
NULL,
|
98
100
|
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
@@ -106,13 +108,15 @@ static VALUE grpc_rb_channel_credentials_alloc(VALUE cls) {
|
|
106
108
|
grpc_rb_channel_credentials *wrapper = ALLOC(grpc_rb_channel_credentials);
|
107
109
|
wrapper->wrapped = NULL;
|
108
110
|
wrapper->mark = Qnil;
|
109
|
-
return TypedData_Wrap_Struct(cls, &grpc_rb_channel_credentials_data_type,
|
111
|
+
return TypedData_Wrap_Struct(cls, &grpc_rb_channel_credentials_data_type,
|
112
|
+
wrapper);
|
110
113
|
}
|
111
114
|
|
112
115
|
/* Creates a wrapping object for a given channel credentials. This should only
|
113
116
|
* be called with grpc_channel_credentials objects that are not already
|
114
117
|
* associated with any Ruby object. */
|
115
|
-
VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c,
|
118
|
+
VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c,
|
119
|
+
VALUE mark) {
|
116
120
|
VALUE rb_wrapper;
|
117
121
|
grpc_rb_channel_credentials *wrapper;
|
118
122
|
if (c == NULL) {
|
@@ -147,7 +151,8 @@ static ID id_pem_cert_chain;
|
|
147
151
|
pem_private_key: (optional) PEM encoding of the client's private key
|
148
152
|
pem_cert_chain: (optional) PEM encoding of the client's cert chain
|
149
153
|
Initializes Credential instances. */
|
150
|
-
static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv,
|
154
|
+
static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv,
|
155
|
+
VALUE self) {
|
151
156
|
VALUE pem_root_certs = Qnil;
|
152
157
|
VALUE pem_private_key = Qnil;
|
153
158
|
VALUE pem_cert_chain = Qnil;
|
@@ -173,8 +178,8 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self)
|
|
173
178
|
} else {
|
174
179
|
key_cert_pair.private_key = RSTRING_PTR(pem_private_key);
|
175
180
|
key_cert_pair.cert_chain = RSTRING_PTR(pem_cert_chain);
|
176
|
-
creds =
|
177
|
-
|
181
|
+
creds =
|
182
|
+
grpc_ssl_credentials_create(pem_root_certs_cstr, &key_cert_pair, NULL);
|
178
183
|
}
|
179
184
|
if (creds == NULL) {
|
180
185
|
rb_raise(rb_eRuntimeError, "could not create a credentials, not sure why");
|
@@ -233,8 +238,8 @@ static VALUE grpc_rb_set_default_roots_pem(VALUE self, VALUE roots) {
|
|
233
238
|
}
|
234
239
|
|
235
240
|
void Init_grpc_channel_credentials() {
|
236
|
-
grpc_rb_cChannelCredentials =
|
237
|
-
|
241
|
+
grpc_rb_cChannelCredentials = rb_define_class_under(
|
242
|
+
grpc_rb_mGrpcCore, "ChannelCredentials", rb_cObject);
|
238
243
|
|
239
244
|
/* Allocates an object managed by the ruby runtime */
|
240
245
|
rb_define_alloc_func(grpc_rb_cChannelCredentials,
|
@@ -262,7 +267,6 @@ void Init_grpc_channel_credentials() {
|
|
262
267
|
grpc_channel_credentials *grpc_rb_get_wrapped_channel_credentials(VALUE v) {
|
263
268
|
grpc_rb_channel_credentials *wrapper = NULL;
|
264
269
|
TypedData_Get_Struct(v, grpc_rb_channel_credentials,
|
265
|
-
&grpc_rb_channel_credentials_data_type,
|
266
|
-
wrapper);
|
270
|
+
&grpc_rb_channel_credentials_data_type, wrapper);
|
267
271
|
return wrapper->wrapped;
|
268
272
|
}
|
@@ -33,14 +33,14 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
36
|
#include "rb_completion_queue.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
38
|
|
39
39
|
#include <ruby/thread.h>
|
40
40
|
|
41
41
|
#include <grpc/grpc.h>
|
42
|
-
#include <grpc/support/time.h>
|
43
42
|
#include <grpc/support/log.h>
|
43
|
+
#include <grpc/support/time.h>
|
44
44
|
#include "rb_grpc.h"
|
45
45
|
|
46
46
|
/* Used to allow grpc_completion_queue_next call to release the GIL */
|
@@ -54,14 +54,13 @@ typedef struct next_call_stack {
|
|
54
54
|
|
55
55
|
/* Calls grpc_completion_queue_pluck without holding the ruby GIL */
|
56
56
|
static void *grpc_rb_completion_queue_pluck_no_gil(void *param) {
|
57
|
-
next_call_stack *const next_call = (next_call_stack*)param;
|
57
|
+
next_call_stack *const next_call = (next_call_stack *)param;
|
58
58
|
gpr_timespec increment = gpr_time_from_millis(20, GPR_TIMESPAN);
|
59
59
|
gpr_timespec deadline;
|
60
60
|
do {
|
61
61
|
deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), increment);
|
62
|
-
next_call->event = grpc_completion_queue_pluck(
|
63
|
-
|
64
|
-
deadline, NULL);
|
62
|
+
next_call->event = grpc_completion_queue_pluck(
|
63
|
+
next_call->cq, next_call->tag, deadline, NULL);
|
65
64
|
if (next_call->event.type != GRPC_QUEUE_TIMEOUT ||
|
66
65
|
gpr_time_cmp(deadline, next_call->timeout) > 0) {
|
67
66
|
break;
|
@@ -81,7 +80,7 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue *cq) {
|
|
81
80
|
}
|
82
81
|
|
83
82
|
static void unblock_func(void *param) {
|
84
|
-
next_call_stack *const next_call = (next_call_stack*)param;
|
83
|
+
next_call_stack *const next_call = (next_call_stack *)param;
|
85
84
|
next_call->interrupted = 1;
|
86
85
|
}
|
87
86
|
|
@@ -111,7 +110,6 @@ grpc_event rb_completion_queue_pluck(grpc_completion_queue *queue, void *tag,
|
|
111
110
|
(void *)&next_call);
|
112
111
|
/* If an interrupt prevented pluck from returning useful information, then
|
113
112
|
any plucks that did complete must have timed out */
|
114
|
-
} while (next_call.interrupted &&
|
115
|
-
next_call.event.type == GRPC_QUEUE_TIMEOUT);
|
113
|
+
} while (next_call.interrupted && next_call.event.type == GRPC_QUEUE_TIMEOUT);
|
116
114
|
return next_call.event;
|
117
115
|
}
|
@@ -33,15 +33,15 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_compression_options.h"
|
37
36
|
#include "rb_byte_buffer.h"
|
37
|
+
#include "rb_compression_options.h"
|
38
38
|
#include "rb_grpc_imports.generated.h"
|
39
39
|
|
40
40
|
#include <grpc/compression.h>
|
41
41
|
#include <grpc/grpc.h>
|
42
|
-
#include <grpc/support/alloc.h>
|
43
42
|
#include <grpc/impl/codegen/compression_types.h>
|
44
43
|
#include <grpc/impl/codegen/grpc_types.h>
|
44
|
+
#include <grpc/support/alloc.h>
|
45
45
|
#include <string.h>
|
46
46
|
|
47
47
|
#include "rb_grpc.h"
|
@@ -182,15 +182,16 @@ void grpc_rb_compression_options_algorithm_name_to_value_internal(
|
|
182
182
|
* correct C string out of it. */
|
183
183
|
algorithm_name_as_string = rb_funcall(algorithm_name, rb_intern("to_s"), 0);
|
184
184
|
|
185
|
-
name_slice =
|
185
|
+
name_slice =
|
186
|
+
grpc_slice_from_copied_buffer(RSTRING_PTR(algorithm_name_as_string),
|
187
|
+
RSTRING_LEN(algorithm_name_as_string));
|
186
188
|
|
187
189
|
/* Raise an error if the name isn't recognized as a compression algorithm by
|
188
190
|
* the algorithm parse function
|
189
191
|
* in GRPC core. */
|
190
|
-
if(!grpc_compression_algorithm_parse(name_slice, algorithm_value)) {
|
192
|
+
if (!grpc_compression_algorithm_parse(name_slice, algorithm_value)) {
|
191
193
|
tmp_str = grpc_slice_to_c_string(name_slice);
|
192
|
-
rb_raise(rb_eNameError, "Invalid compression algorithm name: %s",
|
193
|
-
tmp_str);
|
194
|
+
rb_raise(rb_eNameError, "Invalid compression algorithm name: %s", tmp_str);
|
194
195
|
}
|
195
196
|
|
196
197
|
grpc_slice_unref(name_slice);
|
@@ -33,20 +33,20 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
36
|
#include "rb_event_thread.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
38
|
|
39
39
|
#include <stdbool.h>
|
40
40
|
|
41
|
-
#include <ruby/thread.h>
|
42
41
|
#include <grpc/support/alloc.h>
|
42
|
+
#include <grpc/support/log.h>
|
43
43
|
#include <grpc/support/sync.h>
|
44
44
|
#include <grpc/support/time.h>
|
45
|
-
#include <
|
45
|
+
#include <ruby/thread.h>
|
46
46
|
|
47
47
|
typedef struct grpc_rb_event {
|
48
48
|
// callback will be called with argument while holding the GVL
|
49
|
-
void (*callback)(void*);
|
49
|
+
void (*callback)(void *);
|
50
50
|
void *argument;
|
51
51
|
|
52
52
|
struct grpc_rb_event *next;
|
@@ -65,8 +65,7 @@ typedef struct grpc_rb_event_queue {
|
|
65
65
|
|
66
66
|
static grpc_rb_event_queue event_queue;
|
67
67
|
|
68
|
-
void grpc_rb_event_queue_enqueue(void (*callback)(void*),
|
69
|
-
void *argument) {
|
68
|
+
void grpc_rb_event_queue_enqueue(void (*callback)(void *), void *argument) {
|
70
69
|
grpc_rb_event *event = gpr_malloc(sizeof(grpc_rb_event));
|
71
70
|
event->callback = callback;
|
72
71
|
event->argument = argument;
|
@@ -111,8 +110,7 @@ static void *grpc_rb_wait_for_event_no_gil(void *param) {
|
|
111
110
|
gpr_mu_unlock(&event_queue.mu);
|
112
111
|
return event;
|
113
112
|
}
|
114
|
-
gpr_cv_wait(&event_queue.cv,
|
115
|
-
&event_queue.mu,
|
113
|
+
gpr_cv_wait(&event_queue.cv, &event_queue.mu,
|
116
114
|
gpr_inf_future(GPR_CLOCK_REALTIME));
|
117
115
|
}
|
118
116
|
gpr_mu_unlock(&event_queue.mu);
|
@@ -132,10 +130,10 @@ static void grpc_rb_event_unblocking_func(void *arg) {
|
|
132
130
|
static VALUE grpc_rb_event_thread(VALUE arg) {
|
133
131
|
grpc_rb_event *event;
|
134
132
|
(void)arg;
|
135
|
-
while(true) {
|
136
|
-
event = (grpc_rb_event*)rb_thread_call_without_gvl(
|
137
|
-
grpc_rb_wait_for_event_no_gil, NULL,
|
138
|
-
|
133
|
+
while (true) {
|
134
|
+
event = (grpc_rb_event *)rb_thread_call_without_gvl(
|
135
|
+
grpc_rb_wait_for_event_no_gil, NULL, grpc_rb_event_unblocking_func,
|
136
|
+
NULL);
|
139
137
|
if (event == NULL) {
|
140
138
|
// Indicates that the thread needs to shut down
|
141
139
|
break;
|
data/src/ruby/ext/grpc/rb_grpc.c
CHANGED
@@ -33,8 +33,8 @@
|
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
35
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
36
|
#include "rb_grpc.h"
|
37
|
+
#include "rb_grpc_imports.generated.h"
|
38
38
|
|
39
39
|
#include <math.h>
|
40
40
|
#include <ruby/vm.h>
|
@@ -46,18 +46,19 @@
|
|
46
46
|
#include "rb_call_credentials.h"
|
47
47
|
#include "rb_channel.h"
|
48
48
|
#include "rb_channel_credentials.h"
|
49
|
+
#include "rb_compression_options.h"
|
50
|
+
#include "rb_event_thread.h"
|
49
51
|
#include "rb_loader.h"
|
50
52
|
#include "rb_server.h"
|
51
53
|
#include "rb_server_credentials.h"
|
52
|
-
#include "rb_compression_options.h"
|
53
|
-
#include "rb_event_thread.h"
|
54
|
-
#include "rb_channel.h"
|
55
54
|
|
56
55
|
static VALUE grpc_rb_cTimeVal = Qnil;
|
57
56
|
|
58
57
|
static rb_data_type_t grpc_rb_timespec_data_type = {
|
59
58
|
"gpr_timespec",
|
60
|
-
{GRPC_RB_GC_NOT_MARKED,
|
59
|
+
{GRPC_RB_GC_NOT_MARKED,
|
60
|
+
GRPC_RB_GC_DONT_FREE,
|
61
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
61
62
|
{NULL, NULL}},
|
62
63
|
NULL,
|
63
64
|
NULL,
|
@@ -86,8 +87,7 @@ VALUE grpc_rb_cannot_init(VALUE self) {
|
|
86
87
|
/* Init/Clone func that fails by raising an exception. */
|
87
88
|
VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self) {
|
88
89
|
(void)self;
|
89
|
-
rb_raise(rb_eTypeError,
|
90
|
-
"Copy initialization of %s is not supported",
|
90
|
+
rb_raise(rb_eTypeError, "Copy initialization of %s is not supported",
|
91
91
|
rb_obj_classname(copy));
|
92
92
|
return Qnil;
|
93
93
|
}
|
@@ -145,8 +145,7 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
|
|
145
145
|
}
|
146
146
|
t.tv_sec = (int64_t)f;
|
147
147
|
if (f != t.tv_sec) {
|
148
|
-
rb_raise(rb_eRangeError, "%f out of Time range",
|
149
|
-
RFLOAT_VALUE(time));
|
148
|
+
rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT_VALUE(time));
|
150
149
|
}
|
151
150
|
t.tv_nsec = (int)(d * 1e9 + 0.5);
|
152
151
|
}
|
@@ -271,9 +270,7 @@ static void Init_grpc_time_consts() {
|
|
271
270
|
id_tv_nsec = rb_intern("tv_nsec");
|
272
271
|
}
|
273
272
|
|
274
|
-
static void grpc_rb_shutdown(void) {
|
275
|
-
grpc_shutdown();
|
276
|
-
}
|
273
|
+
static void grpc_rb_shutdown(void) { grpc_shutdown(); }
|
277
274
|
|
278
275
|
/* Initialize the GRPC module structs */
|
279
276
|
|
@@ -338,9 +335,8 @@ void Init_grpc_c() {
|
|
338
335
|
|
339
336
|
grpc_rb_mGRPC = rb_define_module("GRPC");
|
340
337
|
grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core");
|
341
|
-
grpc_rb_sNewServerRpc =
|
342
|
-
|
343
|
-
"deadline", "metadata", "call", NULL);
|
338
|
+
grpc_rb_sNewServerRpc = rb_struct_define(
|
339
|
+
"NewServerRpc", "method", "host", "deadline", "metadata", "call", NULL);
|
344
340
|
grpc_rb_sStatus =
|
345
341
|
rb_struct_define("Status", "code", "details", "metadata", NULL);
|
346
342
|
sym_code = ID2SYM(rb_intern("code"));
|