Class: Biryani::Frame::WindowUpdate
- Inherits:
-
Object
- Object
- Biryani::Frame::WindowUpdate
- Defined in:
- lib/biryani/frame/window_update.rb
Instance Attribute Summary collapse
-
#f_type ⇒ Object
readonly
Returns the value of attribute f_type.
-
#stream_id ⇒ Object
readonly
Returns the value of attribute stream_id.
-
#window_size_increment ⇒ Object
readonly
Returns the value of attribute window_size_increment.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stream_id, window_size_increment) ⇒ WindowUpdate
constructor
A new instance of WindowUpdate.
- #length ⇒ Integer
- #to_binary_s ⇒ String
Constructor Details
#initialize(stream_id, window_size_increment) ⇒ WindowUpdate
Returns a new instance of WindowUpdate.
8 9 10 11 12 |
# File 'lib/biryani/frame/window_update.rb', line 8 def initialize(stream_id, window_size_increment) @f_type = FrameType::WINDOW_UPDATE @stream_id = stream_id @window_size_increment = window_size_increment end |
Instance Attribute Details
#f_type ⇒ Object (readonly)
Returns the value of attribute f_type.
4 5 6 |
# File 'lib/biryani/frame/window_update.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/window_update.rb', line 4 def stream_id @stream_id end |
#window_size_increment ⇒ Object (readonly)
Returns the value of attribute window_size_increment.
4 5 6 |
# File 'lib/biryani/frame/window_update.rb', line 4 def window_size_increment @window_size_increment end |
Class Method Details
.read(s, _flags, stream_id) ⇒ WindowUpdate
32 33 34 35 36 37 38 39 40 |
# File 'lib/biryani/frame/window_update.rb', line 32 def self.read(s, _flags, stream_id) return ConnectionError.new(ErrorCode::FRAME_SIZE_ERROR, 'WINDOW_UPDATE payload length MUST be 4') if s.bytesize != 4 window_size_increment = s.unpack1('N') return ConnectionError.new(ErrorCode::PROTOCOL_ERROR, 'WINDOW_UPDATE invalid window size increment 0') if window_size_increment.zero? return ConnectionError.new(ErrorCode::FLOW_CONTROL_ERROR, 'WINDOW_UPDATE invalid window size increment greater than 2^31-1') if window_size_increment > 2**31 - 1 WindowUpdate.new(stream_id, window_size_increment) end |
Instance Method Details
#length ⇒ Integer
15 16 17 |
# File 'lib/biryani/frame/window_update.rb', line 15 def length 4 end |
#to_binary_s ⇒ String
20 21 22 23 24 25 |
# File 'lib/biryani/frame/window_update.rb', line 20 def to_binary_s payload_length = length flags = 0x00 Frame.to_binary_s_header(payload_length, @f_type, flags, @stream_id) + [@window_size_increment].pack('N') end |