Class: Baykit::BayServer::Docker::Http::H2::Command::CmdGoAway

Inherits:
H2Command
  • Object
show all
Includes:
Baykit::BayServer::Docker::Http::H2, Util
Defined in:
lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb

Instance Attribute Summary collapse

Attributes inherited from H2Command

#flags, #stream_id

Instance Method Summary collapse

Constructor Details

#initialize(stream_id, flags = nil) ⇒ CmdGoAway

Returns a new instance of CmdGoAway.



32
33
34
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 32

def initialize(stream_id, flags=nil)
  super(H2Type::GOAWAY, stream_id, flags)
end

Instance Attribute Details

#debug_dataObject

Returns the value of attribute debug_data.



30
31
32
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 30

def debug_data
  @debug_data
end

#error_codeObject

Returns the value of attribute error_code.



29
30
31
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 29

def error_code
  @error_code
end

#last_stream_idObject

Returns the value of attribute last_stream_id.



28
29
30
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 28

def last_stream_id
  @last_stream_id
end

Instance Method Details

#handle(cmd_handler) ⇒ Object



56
57
58
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 56

def handle(cmd_handler)
  return cmd_handler.handle_go_away(self)
end

#pack(pkt) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 46

def pack(pkt)
  acc = pkt.new_data_accessor()
  acc.put_int(@last_stream_id)
  acc.put_int(@error_code)
  if @debug_data != nil
    acc.put_bytes(@debug_data, 0, @debug_data.length)
  end
  super
end

#unpack(pkt) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb', line 36

def unpack(pkt)
  super
  acc = pkt.new_data_accessor
  val = acc.get_int
  @last_stream_id = H2Packet.extract_int31(val)
  @error_code = acc.get_int
  @debug_data = StringUtil.alloc(pkt.data_len() - acc.pos)
  acc.get_bytes(@debug_data, 0, @debug_data.length)
end