Class: Biryani::Frame::Goaway
- Inherits:
-
Object
- Object
- Biryani::Frame::Goaway
- Defined in:
- lib/biryani/frame/goaway.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#f_type ⇒ Object
readonly
Returns the value of attribute f_type.
-
#last_stream_id ⇒ Object
readonly
Returns the value of attribute last_stream_id.
-
#stream_id ⇒ Object
readonly
Returns the value of attribute stream_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(last_stream_id, error_code, debug) ⇒ Goaway
constructor
A new instance of Goaway.
- #length ⇒ Integer
- #to_binary_s ⇒ String
Constructor Details
#initialize(last_stream_id, error_code, debug) ⇒ Goaway
Returns a new instance of Goaway.
9 10 11 12 13 14 15 |
# File 'lib/biryani/frame/goaway.rb', line 9 def initialize(last_stream_id, error_code, debug) @f_type = FrameType::GOAWAY @stream_id = 0 @last_stream_id = last_stream_id @error_code = error_code @debug = debug end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
4 5 6 |
# File 'lib/biryani/frame/goaway.rb', line 4 def debug @debug end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
4 5 6 |
# File 'lib/biryani/frame/goaway.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/goaway.rb', line 4 def f_type @f_type end |
#last_stream_id ⇒ Object (readonly)
Returns the value of attribute last_stream_id.
4 5 6 |
# File 'lib/biryani/frame/goaway.rb', line 4 def last_stream_id @last_stream_id end |
#stream_id ⇒ Object (readonly)
Returns the value of attribute stream_id.
4 5 6 |
# File 'lib/biryani/frame/goaway.rb', line 4 def stream_id @stream_id end |
Class Method Details
.read(s, _flags, stream_id) ⇒ Goaway
35 36 37 38 39 40 41 42 43 |
# File 'lib/biryani/frame/goaway.rb', line 35 def self.read(s, _flags, stream_id) return ConnectionError.new(ErrorCode::PROTOCOL_ERROR, 'invalid frame') unless stream_id.zero? io = IO::Buffer.for(s) last_stream_id, error_code = io.get_values(%i[U32 U32], 0) debug = io.get_string(8) Goaway.new(last_stream_id, error_code, debug) end |
Instance Method Details
#length ⇒ Integer
18 19 20 |
# File 'lib/biryani/frame/goaway.rb', line 18 def length @debug.bytesize + 8 end |
#to_binary_s ⇒ String
23 24 25 26 27 28 |
# File 'lib/biryani/frame/goaway.rb', line 23 def to_binary_s payload_length = length flags = 0x00 Frame.to_binary_s_header(payload_length, @f_type, flags, @stream_id) + [@last_stream_id, @error_code].pack('NN') + @debug end |