Class: HTTP::Protocol::HTTP2::GoawayFrame

Inherits:
Frame
  • Object
show all
Defined in:
lib/http/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, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #write, #write_header, #write_payload

Constructor Details

This class inherits a constructor from HTTP::Protocol::HTTP2::Frame

Instance Method Details

#apply(connection) ⇒ Object



56
57
58
# File 'lib/http/protocol/http2/goaway_frame.rb', line 56

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

#connection?Boolean

Returns:

  • (Boolean)


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

def connection?
	true
end

#pack(last_stream_id, error_code, data) ⇒ Object



52
53
54
# File 'lib/http/protocol/http2/goaway_frame.rb', line 52

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

#unpackObject



44
45
46
47
48
49
50
# File 'lib/http/protocol/http2/goaway_frame.rb', line 44

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