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.

Methods

Public Class

  1. new

Public Instance

  1. call
  2. handle_socket_timeout
  3. interests
  4. log
  5. state
  6. terminate
  7. timeout
  8. to_io
  9. wakeup

Public Class methods

new()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
120 def initialize
121   @closed = false
122   @pipe_read, @pipe_write = ::IO.pipe
123 end

Public Instance methods

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

noop (the owner connection will take of it)

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
163 def handle_socket_timeout(interval); end
interests()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
148 def interests
149   return if @closed
150 
151   :r
152 end
log(**)

noop

[show source]
    # File lib/httpx/plugins/stream_bidi.rb
130 def log(**); end
state()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
125 def state
126   @closed ? :closed : :open
127 end
terminate()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
156 def terminate
157   @pipe_write.close
158   @pipe_read.close
159   @closed = true
160 end
timeout()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
154 def timeout; end
to_io()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
132 def to_io
133   @pipe_read.to_io
134 end
wakeup()
[show source]
    # File lib/httpx/plugins/stream_bidi.rb
136 def wakeup
137   return if @closed
138 
139   @pipe_write.write("\0")
140 end