Module: GRPC

Defined in:
lib/grpc/errors.rb,
lib/grpc/version.rb,
lib/grpc/notifier.rb,
lib/grpc/generic/service.rb,
lib/grpc/core/time_consts.rb,
lib/grpc/generic/rpc_desc.rb,
lib/grpc/generic/bidi_call.rb,
lib/grpc/generic/rpc_server.rb,
lib/grpc/generic/active_call.rb,
lib/grpc/generic/client_stub.rb,
ext/grpc/rb_grpc.c

Overview

GRPC contains the General RPC module.

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'0.6.1'

Class Method Summary collapse

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
# File '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
    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.



64
65
66
# File 'lib/grpc/generic/rpc_server.rb', line 64

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