class HTTPX::Plugins::StreamBidi::Signal

  1. lib/httpx/plugins/stream_bidi.rb
Superclass: Object

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.

Attributes

error [R]

Public Class methods

new()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
151 def initialize
152   @closed = false
153   @error = nil
154   @pipe_read, @pipe_write = IO.pipe
155 end

Public Instance methods

call()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
174 def call
175   return if @closed
176 
177   @pipe_read.readpartial(1)
178 end
handle_socket_timeout(interval)

noop (the owner connection will take of it)

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
206 def handle_socket_timeout(interval); end
inflight?()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
188 def inflight?
189   !@closed
190 end
interests()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
180 def interests
181   return if @closed
182 
183   :r
184 end
log(**, &_)

noop

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
162 def log(**, &_); end
on_error(error)
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
200 def on_error(error)
201   @error = error
202   terminate
203 end
state()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
157 def state
158   @closed ? :closed : :open
159 end
terminate()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
192 def terminate
193   return if @closed
194 
195   @pipe_write.close
196   @pipe_read.close
197   @closed = true
198 end
timeout()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
186 def timeout; end
to_io()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
164 def to_io
165   @pipe_read.to_io
166 end
wakeup()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
168 def wakeup
169   return if @closed
170 
171   @pipe_write.write("\0")
172 end