Module: GRPC

Extended by:
DefaultLogger, RubyLogger
Defined in:
src/ruby/pb/test/client.rb,
src/ruby/pb/test/server.rb,
src/ruby/bin/math_server.rb,
src/ruby/lib/grpc/errors.rb,
src/ruby/lib/grpc/version.rb,
src/ruby/spec/spec_helper.rb,
src/ruby/lib/grpc/notifier.rb,
src/ruby/lib/grpc/logconfig.rb,
src/ruby/lib/grpc/generic/service.rb,
src/ruby/lib/grpc/core/time_consts.rb,
src/ruby/lib/grpc/generic/rpc_desc.rb,
src/ruby/lib/grpc/generic/bidi_call.rb,
src/ruby/lib/grpc/generic/rpc_server.rb,
src/ruby/lib/grpc/generic/active_call.rb,
src/ruby/lib/grpc/generic/client_stub.rb

Overview

GRPC contains the General RPC module.

Defined Under Namespace

Modules: Core, DefaultLogger, GenericService Classes: ActiveCall, BadStatus, BidiCall, Cancelled, ClientStub, Notifier, Pool, RpcDesc, RpcServer

Constant Summary collapse

VERSION =
'0.13.1'

Constants included from RubyLogger

RubyLogger::LOGGER

Class Method Summary collapse

Methods included from RubyLogger

logger

Methods included from DefaultLogger

logger

Class Method Details

.handle_signalsObject

Handles the signals in $grpc_signals.

Returns:

  • false if the server should exit, true if not.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'src/ruby/lib/grpc/generic/rpc_server.rb', line 43

def handle_signals
  loop do
    sig = $grpc_signals.shift
    case sig
    when 'INT'
      return false
    when 'TERM'
      return false
    when nil
      return true
    end
  end
  true
end

.trap_signalsObject

Sets up a signal handler that adds signals to the signal handling global.

Signal handlers should do as little as humanly possible. Here, they just add themselves to $grpc_signals

RpcServer (and later other parts of gRPC) monitors the signals $grpc_signals in its own non-signal context.



66
67
68
# File 'src/ruby/lib/grpc/generic/rpc_server.rb', line 66

def trap_signals
  %w(INT TERM).each { |sig| trap(sig) { $grpc_signals << sig } }
end