Class: Protocol::HTTP2::ResetStreamFrame
- Defined in:
- lib/protocol/http2/reset_stream_frame.rb
Overview
The RST_STREAM frame allows for immediate termination of a stream. RST_STREAM is sent to request cancellation of a stream or to indicate that an error condition has occurred.
---------------------------------------------------------------
| Error Code (32) | ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x3
- FORMAT =
"N".freeze
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
- #pack(error_code = NO_ERROR) ⇒ Object
- #read_payload(stream) ⇒ Object
- #unpack ⇒ Object
Methods inherited from Frame
#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, parse_header, #read, #read_header, #set_flags, #to_ary, #write, #write_header, #write_payload
Constructor Details
This class inherits a constructor from Protocol::HTTP2::Frame
Instance Method Details
#apply(connection) ⇒ Object
59 60 61 |
# File 'lib/protocol/http2/reset_stream_frame.rb', line 59 def apply(connection) connection.receive_reset_stream(self) end |
#pack(error_code = NO_ERROR) ⇒ Object
54 55 56 57 |
# File 'lib/protocol/http2/reset_stream_frame.rb', line 54 def pack(error_code = NO_ERROR) @payload = [error_code].pack(FORMAT) @length = @payload.bytesize end |
#read_payload(stream) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/protocol/http2/reset_stream_frame.rb', line 63 def read_payload(stream) super if @length != 4 raise FrameSizeError, "Invalid frame length" end end |
#unpack ⇒ Object
50 51 52 |
# File 'lib/protocol/http2/reset_stream_frame.rb', line 50 def unpack @payload.unpack(FORMAT).first end |