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
Public Instance
Public Instance Aliases
| on_io_error | -> | on_error |
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
force_close(*)
[show source]
# File lib/httpx/plugins/stream_bidi.rb 192 def force_close(*) 193 terminate 194 end
handle_socket_timeout(interval)
noop (the owner connection will take of it)
[show source]
# File lib/httpx/plugins/stream_bidi.rb 212 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
on_error(error)
[show source]
# File lib/httpx/plugins/stream_bidi.rb 204 def on_error(error) 205 @error = error 206 terminate 207 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 196 def terminate 197 return if @closed 198 199 @pipe_write.close 200 @pipe_read.close 201 @closed = true 202 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