Class: Protocol::HTTP2::GoawayFrame

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

Overview

The GOAWAY frame is used to initiate shutdown of a connection or to signal serious error conditions. GOAWAY allows an endpoint to gracefully stop accepting new streams while still finishing processing of previously established streams. This enables administrative actions, like server maintenance.

-————————————————————-+ |R| Last-Stream-ID (31) | -————————————————————-+ | Error Code (32) | --------------------------------------------------------------- | Additional Debug Data (*) | ---------------------------------------------------------------

Constant Summary collapse

TYPE =
0x7
FORMAT =
"NN"

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



40
41
42
# File 'lib/protocol/http2/goaway_frame.rb', line 40

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

#connection?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/protocol/http2/goaway_frame.rb', line 24

def connection?
	true
end

#pack(last_stream_id, error_code, data) ⇒ Object



36
37
38
# File 'lib/protocol/http2/goaway_frame.rb', line 36

def pack(last_stream_id, error_code, data)
	super [last_stream_id, error_code].pack(FORMAT) + data
end

#unpackObject



28
29
30
31
32
33
34
# File 'lib/protocol/http2/goaway_frame.rb', line 28

def unpack
	data = super
	
	last_stream_id, error_code = data.unpack(FORMAT)
	
	return last_stream_id, error_code, data.slice(8, data.bytesize-8)
end