Class: Biryani::Frame::RstStream
- Inherits:
-
Object
- Object
- Biryani::Frame::RstStream
- Defined in:
- lib/biryani/frame/rst_stream.rb
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#f_type ⇒ Object
readonly
Returns the value of attribute f_type.
-
#stream_id ⇒ Object
readonly
Returns the value of attribute stream_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stream_id, error_code) ⇒ RstStream
constructor
A new instance of RstStream.
- #length ⇒ Integer
- #to_binary_s ⇒ String
Constructor Details
#initialize(stream_id, error_code) ⇒ RstStream
Returns a new instance of RstStream.
8 9 10 11 12 |
# File 'lib/biryani/frame/rst_stream.rb', line 8 def initialize(stream_id, error_code) @f_type = FrameType::RST_STREAM @stream_id = stream_id @error_code = error_code end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
4 5 6 |
# File 'lib/biryani/frame/rst_stream.rb', line 4 def error_code @error_code end |
#f_type ⇒ Object (readonly)
Returns the value of attribute f_type.
4 5 6 |
# File 'lib/biryani/frame/rst_stream.rb', line 4 def f_type @f_type end |
#stream_id ⇒ Object (readonly)
Returns the value of attribute stream_id.
4 5 6 |
# File 'lib/biryani/frame/rst_stream.rb', line 4 def stream_id @stream_id end |
Class Method Details
.read(s, _flags, stream_id) ⇒ RstStream
32 33 34 35 36 37 |
# File 'lib/biryani/frame/rst_stream.rb', line 32 def self.read(s, _flags, stream_id) return ConnectionError.new(ErrorCode::FRAME_SIZE_ERROR, 'RST_STREAM payload length MUST be 4') if s.bytesize != 4 error_code = s.unpack1('N') RstStream.new(stream_id, error_code) end |
Instance Method Details
#length ⇒ Integer
15 16 17 |
# File 'lib/biryani/frame/rst_stream.rb', line 15 def length 4 end |
#to_binary_s ⇒ String
20 21 22 23 24 25 |
# File 'lib/biryani/frame/rst_stream.rb', line 20 def to_binary_s payload_length = length flags = 0x00 Frame.to_binary_s_header(payload_length, @f_type, flags, @stream_id) + [@error_code].pack('N') end |