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
122 def initialize
123   @closed = false
124   @error = nil
125   @pipe_read, @pipe_write = IO.pipe
126 end

Public Instance methods

call()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
145 def call
146   return if @closed
147 
148   @pipe_read.readpartial(1)
149 end
handle_socket_timeout(interval)

noop (the owner connection will take of it)

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
171 def handle_socket_timeout(interval); end
interests()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
151 def interests
152   return if @closed
153 
154   :r
155 end
log(**, &_)

noop

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
133 def log(**, &_); end
on_error(error)
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
165 def on_error(error)
166   @error = error
167   terminate
168 end
state()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
128 def state
129   @closed ? :closed : :open
130 end
terminate()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
159 def terminate
160   @pipe_write.close
161   @pipe_read.close
162   @closed = true
163 end
timeout()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
157 def timeout; end
to_io()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
135 def to_io
136   @pipe_read.to_io
137 end
wakeup()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
139 def wakeup
140   return if @closed
141 
142   @pipe_write.write("\0")
143 end