Class: HTTPX::Plugins::StreamBidi::Signal
- Inherits:
-
Object
- Object
- HTTPX::Plugins::StreamBidi::Signal
- Defined in:
- lib/httpx/plugins/stream_bidi.rb
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 Method Summary collapse
- #call ⇒ Object
-
#handle_socket_timeout(interval) ⇒ Object
noop (the owner connection will take of it).
-
#initialize ⇒ Signal
constructor
A new instance of Signal.
- #interests ⇒ Object
-
#log ⇒ Object
noop.
- #state ⇒ Object
- #terminate ⇒ Object
- #timeout ⇒ Object
- #to_io ⇒ Object
- #wakeup ⇒ Object
Constructor Details
#initialize ⇒ Signal
Returns a new instance of Signal.
120 121 122 123 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 120 def initialize @closed = false @pipe_read, @pipe_write = ::IO.pipe end |
Instance Method Details
#call ⇒ Object
142 143 144 145 146 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 142 def call return if @closed @pipe_read.readpartial(1) end |
#handle_socket_timeout(interval) ⇒ Object
noop (the owner connection will take of it)
163 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 163 def handle_socket_timeout(interval); end |
#interests ⇒ Object
148 149 150 151 152 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 148 def interests return if @closed :r end |
#log ⇒ Object
noop
130 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 130 def log(**); end |
#state ⇒ Object
125 126 127 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 125 def state @closed ? :closed : :open end |
#terminate ⇒ Object
156 157 158 159 160 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 156 def terminate @pipe_write.close @pipe_read.close @closed = true end |
#timeout ⇒ Object
154 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 154 def timeout; end |
#to_io ⇒ Object
132 133 134 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 132 def to_io @pipe_read.to_io end |
#wakeup ⇒ Object
136 137 138 139 140 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 136 def wakeup return if @closed @pipe_write.write("\0") end |