Class: GrpcKit::Session::DrainController

Inherits:
Object
  • Object
show all
Defined in:
lib/grpc_kit/session/drain_controller.rb

Instance Method Summary collapse

Constructor Details

#initializeDrainController

Returns a new instance of DrainController


8
9
10
11
12
13
# File 'lib/grpc_kit/session/drain_controller.rb', line 8

def initialize
  @sent_shutdown_notice = false
  @goaway_sent = false
  @after_one_rtt = false
  # @sent_ping = false
end

Instance Method Details

#call(session) ⇒ void

This method returns an undefined value.


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/grpc_kit/session/drain_controller.rb', line 21

def call(session)
  if @goaway_sent
  # session.shutdown
  elsif @sent_shutdown_notice && @after_one_rtt
    session.submit_goaway(DS9::NO_ERROR, session.last_proc_stream_id)
    @goaway_sent = true
  # elsif @sent_shutdown_notice && [email protected]_one_rtt && [email protected]_ping
  # @sent_ping = true
  elsif !@sent_shutdown_notice
    session.submit_shutdown
    @sent_shutdown_notice = true
    session.submit_ping # wait for 1 RTT
  end
end

#recv_ping_ackvoid

This method returns an undefined value.


16
17
18
# File 'lib/grpc_kit/session/drain_controller.rb', line 16

def recv_ping_ack
  @after_one_rtt = true
end