Class: Baykit::BayServer::Docker::Fcgi::FcgCommand

Inherits:
Protocol::Command
  • Object
show all
Defined in:
lib/baykit/bayserver/docker/fcgi/fcg_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, req_id) ⇒ FcgCommand

Returns a new instance of FcgCommand.



9
10
11
12
# File 'lib/baykit/bayserver/docker/fcgi/fcg_command.rb', line 9

def initialize(type, req_id)
  super(type)
  @req_id = req_id
end

Instance Attribute Details

#req_idObject (readonly)

Returns the value of attribute req_id.



7
8
9
# File 'lib/baykit/bayserver/docker/fcgi/fcg_command.rb', line 7

def req_id
  @req_id
end

Instance Method Details

#pack(pkt) ⇒ Object

Super class method must be called from last line of override method since header cannot be packed before data is constructed



22
23
24
25
# File 'lib/baykit/bayserver/docker/fcgi/fcg_command.rb', line 22

def pack(pkt)
  pkt.req_id = @req_id
  pack_header(pkt)
end

#pack_header(pkt) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/baykit/bayserver/docker/fcgi/fcg_command.rb', line 27

def pack_header(pkt)
  acc = pkt.new_header_accessor()
  acc.put_byte(pkt.version)
  acc.put_byte(pkt.type)
  acc.put_short(pkt.req_id)
  acc.put_short(pkt.data_len)
  acc.put_byte(0)  # paddinglen
  acc.put_byte(0)  # reserved
end

#unpack(pkt) ⇒ Object



14
15
16
# File 'lib/baykit/bayserver/docker/fcgi/fcg_command.rb', line 14

def unpack(pkt)
  @req_id = pkt.req_id
end