passing interests call to the underlying io object, which makes it more accurate for the ssl case

This commit is contained in:
HoneyryderChuck 2020-04-11 15:57:17 +01:00
parent 83b9c645d1
commit 78ce18027c
4 changed files with 9 additions and 5 deletions

View File

@ -180,9 +180,7 @@ module HTTPX
if connecting?
return :w unless @io
return :rw if @io.state == :connected
return :w
return @io.interests
end
# if the write buffer is full, we drain it

View File

@ -62,8 +62,10 @@ module HTTPX
@io.connect_nonblock
@io.post_connection_check(@hostname) if @ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE
transition(:negotiated)
rescue ::IO::WaitReadable,
::IO::WaitWritable
rescue ::IO::WaitReadable
@interests = :r
rescue ::IO::WaitWritable
@interests = :w
end
# :nocov:

View File

@ -13,6 +13,8 @@ module HTTPX
attr_reader :state
attr_reader :interests
alias_method :host, :ip
def initialize(origin, addresses, options)
@ -22,6 +24,7 @@ module HTTPX
@options = Options.new(options)
@fallback_protocol = @options.fallback_protocol
@port = origin.port
@interests = :w
if @options.io
@io = case @options.io
when Hash

View File

@ -15,6 +15,7 @@ module HTTPX
@options = Options.new(options)
@path = @options.transport_options[:path]
@fallback_protocol = @options.fallback_protocol
@interests = :w
if @options.io
@io = case @options.io
when Hash