Class: HTTPX::Plugins::StreamBidi::Signal
- Inherits:
-
Object
- Object
- HTTPX::Plugins::StreamBidi::Signal
- Includes:
- _Selectable
- Defined in:
- lib/httpx/plugins/stream_bidi.rb,
sig/plugins/stream_bidi.rbs
Overview
Proxy to wake up the session main loop when one of the connections has buffered data to write. It abides by the HTTPX::_Selectable API, which allows it to be registered in the selector alongside actual HTTP-based HTTPX::Connection objects.
Instance Attribute Summary collapse
-
#error ⇒ Exception?
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #call ⇒ Object
- #force_close ⇒ Object
-
#handle_socket_timeout(interval) ⇒ Object
noop (the owner connection will take of it).
- #inflight? ⇒ Boolean
- #initial_call ⇒ Object
-
#initialize ⇒ Signal
constructor
A new instance of Signal.
- #interests ⇒ Object
-
#log(&_) ⇒ Object
noop.
- #on_error(error) ⇒ Object (also: #on_io_error)
- #state ⇒ Object
- #terminate ⇒ Object
- #timeout ⇒ Object
- #to_io ⇒ Object
- #wakeup ⇒ void
Constructor Details
#initialize ⇒ Signal
Returns a new instance of Signal.
151 152 153 154 155 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 151 def initialize @closed = false @error = nil @pipe_read, @pipe_write = IO.pipe end |
Instance Attribute Details
#error ⇒ Exception? (readonly)
Returns the value of attribute error.
149 150 151 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 149 def error @error end |
Instance Method Details
#call ⇒ Object
174 175 176 177 178 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 174 def call return if @closed @pipe_read.readpartial(1) end |
#force_close ⇒ Object
194 195 196 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 194 def force_close(*) terminate end |
#handle_socket_timeout(interval) ⇒ Object
noop (the owner connection will take of it)
214 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 214 def handle_socket_timeout(interval); end |
#inflight? ⇒ Boolean
190 191 192 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 190 def inflight? !@closed end |
#initial_call ⇒ Object
180 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 180 def initial_call; end |
#interests ⇒ Object
182 183 184 185 186 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 182 def interests return if @closed :r end |
#log(&_) ⇒ Object
noop
162 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 162 def log(**, &_); end |
#on_error(error) ⇒ Object Also known as: on_io_error
206 207 208 209 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 206 def on_error(error) @error = error terminate end |
#state ⇒ Object
157 158 159 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 157 def state @closed ? :closed : :open end |
#terminate ⇒ Object
198 199 200 201 202 203 204 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 198 def terminate return if @closed @pipe_write.close @pipe_read.close @closed = true end |
#timeout ⇒ Object
188 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 188 def timeout; end |
#to_io ⇒ Object
164 165 166 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 164 def to_io @pipe_read.to_io end |
#wakeup ⇒ void
This method returns an undefined value.
168 169 170 171 172 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 168 def wakeup return if @closed @pipe_write.write("\0") end |