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

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

Instance Attribute Summary collapse

Attributes inherited from H2Command

#flags, #stream_id

Instance Method Summary collapse

Constructor Details

#initialize(stream_id, flags = nil, opaque_data = nil) ⇒ CmdPing

Returns a new instance of CmdPing.



17
18
19
20
21
22
23
24
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb', line 17

def initialize(stream_id, flags=nil, opaque_data=nil)
  super(H2Type::PING, stream_id, flags)
  if opaque_data == nil
    @opaque_data = [0, 0, 0, 0, 0, 0, 0, 0].pack("C*")
  else
    @opaque_data = opaque_data
  end
end

Instance Attribute Details

#opaque_dataObject (readonly)

Returns the value of attribute opaque_data.



15
16
17
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb', line 15

def opaque_data
  @opaque_data
end

Instance Method Details

#handle(cmd_handler) ⇒ Object



39
40
41
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb', line 39

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

#pack(pkt) ⇒ Object



33
34
35
36
37
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb', line 33

def pack(pkt)
  acc = pkt.new_data_accessor()
  acc.put_bytes(@opaque_data)
  super
end

#unpack(pkt) ⇒ Object



26
27
28
29
30
31
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb', line 26

def unpack(pkt)
  super
  acc = pkt.new_data_accessor()

  acc.get_bytes(@opaque_data, 0, 8)
end