Class: Protocol::HTTP2::GoawayFrame
- Defined in:
- lib/protocol/http2/goaway_frame.rb
Overview
The GOAWAY frame is used to initiate shutdown of a connection or to signal serious error conditions. GOAWAY allows an endpoint to gracefully stop accepting new streams while still finishing processing of previously established streams. This enables administrative actions, like server maintenance.
-
————————————————————-+ |R| Last-Stream-ID (31) | -
————————————————————-+ | Error Code (32) | ---------------------------------------------------------------
| Additional Debug Data (*) | ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x7
- FORMAT =
"NN"
Constants inherited from Frame
Frame::HEADER_FORMAT, Frame::LENGTH_HISHIFT, Frame::LENGTH_LOMASK, Frame::STREAM_ID_MASK, Frame::VALID_LENGTH, Frame::VALID_STREAM_ID
Instance Attribute Summary
Attributes inherited from Frame
#flags, #length, #payload, #stream_id, #type
Instance Method Summary collapse
- #apply(connection) ⇒ Object
- #connection? ⇒ Boolean
- #pack(last_stream_id, error_code, data) ⇒ Object
- #unpack ⇒ Object
Methods inherited from Frame
#<=>, #clear_flags, #flag_set?, #header, #initialize, #inspect, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #valid_type?, #write, #write_header, #write_payload
Constructor Details
This class inherits a constructor from Protocol::HTTP2::Frame
Instance Method Details
#apply(connection) ⇒ Object
55 56 57 |
# File 'lib/protocol/http2/goaway_frame.rb', line 55 def apply(connection) connection.receive_goaway(self) end |
#connection? ⇒ Boolean
39 40 41 |
# File 'lib/protocol/http2/goaway_frame.rb', line 39 def connection? true end |
#pack(last_stream_id, error_code, data) ⇒ Object
51 52 53 |
# File 'lib/protocol/http2/goaway_frame.rb', line 51 def pack(last_stream_id, error_code, data) super [last_stream_id, error_code].pack(FORMAT) + data end |
#unpack ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/protocol/http2/goaway_frame.rb', line 43 def unpack data = super last_stream_id, error_code = data.unpack(FORMAT) return last_stream_id, error_code, data.slice(8, data.bytesize-8) end |