diff options
Diffstat (limited to 'src/ruby')
-rw-r--r-- | src/ruby/.rubocop.yml | 4 | ||||
-rw-r--r-- | src/ruby/ext/grpc/extconf.rb | 8 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_byte_buffer.c | 3 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_call.c | 3 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_call_credentials.c | 6 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_channel.c | 3 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_channel_args.c | 3 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_channel_credentials.c | 5 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_completion_queue.c | 2 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_event_thread.c | 2 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_grpc.c | 2 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_server.c | 3 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_server_credentials.c | 3 | ||||
-rw-r--r-- | src/ruby/lib/grpc/generic/rpc_server.rb | 17 | ||||
-rw-r--r-- | src/ruby/lib/grpc/version.rb | 2 | ||||
-rw-r--r-- | src/ruby/tools/version.rb | 2 |
16 files changed, 33 insertions, 35 deletions
diff --git a/src/ruby/.rubocop.yml b/src/ruby/.rubocop.yml index d13ce42655..34bb477543 100644 --- a/src/ruby/.rubocop.yml +++ b/src/ruby/.rubocop.yml @@ -11,10 +11,10 @@ AllCops: - 'pb/test/**/*' Metrics/CyclomaticComplexity: - Max: 8 + Max: 9 Metrics/PerceivedComplexity: - Max: 8 + Max: 9 Metrics/ClassLength: Max: 250 diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 07f7bb93b8..6d65db8306 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -78,9 +78,11 @@ output_dir = File.expand_path(RbConfig::CONFIG['topdir']) grpc_lib_dir = File.join(output_dir, 'libs', grpc_config) ENV['BUILDDIR'] = output_dir -puts 'Building internal gRPC into ' + grpc_lib_dir -system("make -j -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") -exit 1 unless $? == 0 +unless windows + puts 'Building internal gRPC into ' + grpc_lib_dir + system("make -j -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") + exit 1 unless $? == 0 +end $CFLAGS << ' -I' + File.join(grpc_root, 'include') $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index cba910d832..1172691116 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_byte_buffer.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/byte_buffer_reader.h> #include <grpc/support/slice.h> diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 48c49a21e9..1b06273af9 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_call.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/support/alloc.h> diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c index 38bf1f7710..79ca5b32ce 100644 --- a/src/ruby/ext/grpc/rb_call_credentials.c +++ b/src/ruby/ext/grpc/rb_call_credentials.c @@ -32,10 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_call_credentials.h" -#include <ruby/ruby.h> #include <ruby/thread.h> #include <grpc/grpc.h> @@ -86,11 +86,11 @@ static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args, rb_funcall(exception_object, rb_intern("backtrace"), 0), rb_intern("join"), 1, rb_str_new2("\n\tfrom ")); - VALUE exception_info = rb_funcall(exception_object, rb_intern("to_s"), 0); + VALUE rb_exception_info = rb_funcall(exception_object, rb_intern("to_s"), 0); const char *exception_classname = rb_obj_classname(exception_object); (void)args; gpr_log(GPR_INFO, "Call credentials callback failed: %s: %s\n%s", - exception_classname, StringValueCStr(exception_info), + exception_classname, StringValueCStr(rb_exception_info), StringValueCStr(backtrace)); rb_hash_aset(result, rb_str_new2("metadata"), Qnil); /* Currently only gives the exception class name. It should be possible get diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 984afad107..013321ffc8 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_channel.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/grpc_security.h> #include <grpc/support/alloc.h> diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c index 2ffb8f41da..87c0e0a705 100644 --- a/src/ruby/ext/grpc/rb_channel_args.c +++ b/src/ruby/ext/grpc/rb_channel_args.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_channel_args.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include "rb_grpc.h" diff --git a/src/ruby/ext/grpc/rb_channel_credentials.c b/src/ruby/ext/grpc/rb_channel_credentials.c index 09bd3093a9..cbb23885aa 100644 --- a/src/ruby/ext/grpc/rb_channel_credentials.c +++ b/src/ruby/ext/grpc/rb_channel_credentials.c @@ -31,14 +31,13 @@ * */ +#include <ruby/ruby.h> + #include <string.h> -#include <ruby/ruby.h> #include "rb_grpc_imports.generated.h" #include "rb_channel_credentials.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/grpc_security.h> #include <grpc/support/alloc.h> diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 2a2eee190c..4bb615f8be 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -32,10 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_completion_queue.h" -#include <ruby/ruby.h> #include <ruby/thread.h> #include <grpc/grpc.h> diff --git a/src/ruby/ext/grpc/rb_event_thread.c b/src/ruby/ext/grpc/rb_event_thread.c index 2649a1087f..9e85bbcfbf 100644 --- a/src/ruby/ext/grpc/rb_event_thread.c +++ b/src/ruby/ext/grpc/rb_event_thread.c @@ -32,12 +32,12 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_event_thread.h" #include <stdbool.h> -#include <ruby/ruby.h> #include <ruby/thread.h> #include <grpc/support/alloc.h> #include <grpc/support/sync.h> diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index acb47b0055..06a07ac646 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -32,11 +32,11 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_grpc.h" #include <math.h> -#include <ruby/ruby.h> #include <ruby/vm.h> #include <sys/time.h> diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 96e60c6776..2b3acaaf59 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_server.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/grpc_security.h> #include "rb_call.h" diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index b2d7280a30..3b0fb6c910 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -32,11 +32,10 @@ */ #include <ruby/ruby.h> + #include "rb_grpc_imports.generated.h" #include "rb_server_credentials.h" -#include <ruby/ruby.h> - #include <grpc/grpc.h> #include <grpc/grpc_security.h> diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 7f3a38a9f4..a0f4071adc 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -332,15 +332,13 @@ module GRPC # the current thread to terminate it. def run_till_terminated GRPC.trap_signals - stopped = false t = Thread.new do run - stopped = true end + t.abort_on_exception = true wait_till_running - loop do + until running_state == :stopped sleep SIGNAL_CHECK_PERIOD - break if stopped break unless GRPC.handle_signals end stop @@ -416,7 +414,7 @@ module GRPC GRPC.logger.warn("NOT AVAILABLE: too many jobs_waiting: #{an_rpc}") noop = proc { |x| x } c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline) - c.send_status(StatusCodes::RESOURCE_EXHAUSTED, '') + c.send_status(GRPC::Core::StatusCodes::RESOURCE_EXHAUSTED, '') nil end @@ -427,7 +425,7 @@ module GRPC GRPC.logger.warn("UNIMPLEMENTED: #{an_rpc}") noop = proc { |x| x } c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline) - c.send_status(StatusCodes::UNIMPLEMENTED, '') + c.send_status(GRPC::Core::StatusCodes::UNIMPLEMENTED, '') nil end @@ -443,7 +441,12 @@ module GRPC unless active_call.nil? @pool.schedule(active_call) do |ac| c, mth = ac - rpc_descs[mth].run_server_method(c, rpc_handlers[mth]) + begin + rpc_descs[mth].run_server_method(c, rpc_handlers[mth]) + rescue StandardError + c.send_status(GRPC::Core::StatusCodes::INTERNAL, + 'Server handler failed') + end end end rescue Core::CallError, RuntimeError => e diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 67c6a5d5a1..01c8c5ac8f 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.14.0.dev' + VERSION = '0.15.0.dev' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 12ad21b80e..dca7fd7e72 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '0.14.0.dev' + VERSION = '0.15.0.dev' end end |