Class: Quicsilver::Transport::StreamEvent
- Inherits:
-
Object
- Object
- Quicsilver::Transport::StreamEvent
- Defined in:
- lib/quicsilver/transport/stream_event.rb
Overview
Parses the binary data packed by the C extension for stream completion events. C packs events as:
RECEIVE_FIN: [stream_handle(8)][payload...]
STREAM_RESET: [stream_handle(8)][error_code(8)]
STOP_SENDING: [stream_handle(8)][error_code(8)]
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#initialize(raw_data, event_type) ⇒ StreamEvent
constructor
A new instance of StreamEvent.
Constructor Details
#initialize(raw_data, event_type) ⇒ StreamEvent
Returns a new instance of StreamEvent.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/quicsilver/transport/stream_event.rb', line 13 def initialize(raw_data, event_type) @handle = raw_data[0, 8].unpack1("Q") remaining = raw_data[8..] || "".b case event_type when "RECEIVE_FIN" @data = remaining when "STREAM_RESET", "STOP_SENDING" @error_code = remaining.unpack1("Q") end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/quicsilver/transport/stream_event.rb', line 11 def data @data end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
11 12 13 |
# File 'lib/quicsilver/transport/stream_event.rb', line 11 def error_code @error_code end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
11 12 13 |
# File 'lib/quicsilver/transport/stream_event.rb', line 11 def handle @handle end |