diff options
Diffstat (limited to 'src/ruby/bin')
-rwxr-xr-x | src/ruby/bin/math_client.rb | 6 | ||||
-rwxr-xr-x | src/ruby/bin/math_server.rb | 19 | ||||
-rwxr-xr-x | src/ruby/bin/noproto_server.rb | 3 |
3 files changed, 23 insertions, 5 deletions
diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb index 6319cda309..0ebd26f780 100755 --- a/src/ruby/bin/math_client.rb +++ b/src/ruby/bin/math_client.rb @@ -50,7 +50,7 @@ def do_div(stub) GRPC.logger.info('----------------') req = Math::DivArgs.new(dividend: 7, divisor: 3) GRPC.logger.info("div(7/3): req=#{req.inspect}") - resp = stub.div(req, INFINITE_FUTURE) + resp = stub.div(req, timeout: INFINITE_FUTURE) GRPC.logger.info("Answer: #{resp.inspect}") GRPC.logger.info('----------------') end @@ -71,7 +71,7 @@ def do_fib(stub) GRPC.logger.info('----------------') req = Math::FibArgs.new(limit: 11) GRPC.logger.info("fib(11): req=#{req.inspect}") - resp = stub.fib(req, INFINITE_FUTURE) + resp = stub.fib(req, timeout: INFINITE_FUTURE) resp.each do |r| GRPC.logger.info("Answer: #{r.inspect}") end @@ -86,7 +86,7 @@ def do_div_many(stub) reqs << Math::DivArgs.new(dividend: 5, divisor: 2) reqs << Math::DivArgs.new(dividend: 7, divisor: 2) GRPC.logger.info("div(7/3), div(5/2), div(7/2): reqs=#{reqs.inspect}") - resp = stub.div_many(reqs, 10) + resp = stub.div_many(reqs, timeout: INFINITE_FUTURE) resp.each do |r| GRPC.logger.info("Answer: #{r.inspect}") end diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb index b41ccf6ce1..562f197317 100755 --- a/src/ruby/bin/math_server.rb +++ b/src/ruby/bin/math_server.rb @@ -41,9 +41,25 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) require 'forwardable' require 'grpc' +require 'logger' require 'math_services' require 'optparse' +# RubyLogger defines a logger for gRPC based on the standard ruby logger. +module RubyLogger + def logger + LOGGER + end + + LOGGER = Logger.new(STDOUT) +end + +# GRPC is the general RPC module +module GRPC + # Inject the noop #logger if no module-level logger method has been injected. + extend RubyLogger +end + # Holds state for a fibonacci series class Fibber def initialize(limit) @@ -155,7 +171,8 @@ end def test_server_creds certs = load_test_certs - GRPC::Core::ServerCredentials.new(nil, certs[1], certs[2]) + GRPC::Core::ServerCredentials.new( + nil, [{ private_key: certs[1], cert_chain: certs[2] }], false) end def main diff --git a/src/ruby/bin/noproto_server.rb b/src/ruby/bin/noproto_server.rb index 90baaf9a2e..72a5762040 100755 --- a/src/ruby/bin/noproto_server.rb +++ b/src/ruby/bin/noproto_server.rb @@ -77,7 +77,8 @@ end def test_server_creds certs = load_test_certs - GRPC::Core::ServerCredentials.new(nil, certs[1], certs[2]) + GRPC::Core::ServerCredentials.new( + nil, [{ private_key: certs[1], cert_chain: certs[2] }], false) end def main |