Class: Quicsilver::Transport::Stream
- Inherits:
-
Object
- Object
- Quicsilver::Transport::Stream
- Defined in:
- lib/quicsilver/transport/stream.rb
Overview
Wraps a QUIC stream opened by Ruby code (client requests, server control streams). Encapsulates the C handle — callers use send/reset/stop_sending methods instead of passing raw pointers to Quicsilver.send_stream etc.
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#initialize(handle) ⇒ Stream
constructor
A new instance of Stream.
- #reset(error_code = Protocol::H3_REQUEST_CANCELLED) ⇒ Object
- #send(data, fin: false) ⇒ Object
- #stop_sending(error_code = Protocol::H3_REQUEST_CANCELLED) ⇒ Object
Constructor Details
#initialize(handle) ⇒ Stream
Returns a new instance of Stream.
11 12 13 |
# File 'lib/quicsilver/transport/stream.rb', line 11 def initialize(handle) @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
9 10 11 |
# File 'lib/quicsilver/transport/stream.rb', line 9 def handle @handle end |
Instance Method Details
#reset(error_code = Protocol::H3_REQUEST_CANCELLED) ⇒ Object
19 20 21 |
# File 'lib/quicsilver/transport/stream.rb', line 19 def reset(error_code = Protocol::H3_REQUEST_CANCELLED) Quicsilver.stream_reset(@handle, error_code) end |
#send(data, fin: false) ⇒ Object
15 16 17 |
# File 'lib/quicsilver/transport/stream.rb', line 15 def send(data, fin: false) Quicsilver.send_stream(@handle, data, fin) end |
#stop_sending(error_code = Protocol::H3_REQUEST_CANCELLED) ⇒ Object
23 24 25 |
# File 'lib/quicsilver/transport/stream.rb', line 23 def stop_sending(error_code = Protocol::H3_REQUEST_CANCELLED) Quicsilver.stream_stop_sending(@handle, error_code) end |