Class: Protocol::HTTP2::WindowUpdateFrame

Inherits:
Frame
  • Object
show all
Defined in:
lib/protocol/http2/window_update_frame.rb

Overview

The WINDOW_UPDATE frame is used to implement flow control.

-————————————————————-+ |R| Window Size Increment (31) | -————————————————————-+

Constant Summary collapse

TYPE =
0x8
FORMAT =
"N"

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

Methods inherited from Frame

#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, #inspect, parse_header, #read, #read_header, #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

Apply this WINDOW_UPDATE frame to a connection for processing.



46
47
48
# File 'lib/protocol/http2/window_update_frame.rb', line 46

def apply(connection)
  connection.receive_window_update(self)
end

#pack(window_size_increment) ⇒ Object

Pack a window size increment into the frame.



23
24
25
# File 'lib/protocol/http2/window_update_frame.rb', line 23

def pack(window_size_increment)
  super [window_size_increment].pack(FORMAT)
end

#read_payload(stream) ⇒ Object

Read and validate the WINDOW_UPDATE frame payload.



36
37
38
39
40
41
42
# File 'lib/protocol/http2/window_update_frame.rb', line 36

def read_payload(stream)
  super
  
  if @length != 4
    raise FrameSizeError, "Invalid frame length: #{@length} != 4!"
  end
end

#unpackObject

Unpack the window size increment from the frame payload.



29
30
31
# File 'lib/protocol/http2/window_update_frame.rb', line 29

def unpack
  super.unpack1(FORMAT)
end