Methods
Public Class
Public Instance
Constants
DONE | = | 1 | ||
ERROR | = | 2 | ||
RESOLV_ERRORS | = | [Resolv::ResolvError, Resolv::DNS::Requester::RequestError, Resolv::DNS::EncodeError, Resolv::DNS::DecodeError].freeze |
Attributes
state | [R] |
Public Class methods
new(options)
[show source]
# File lib/httpx/resolver/system.rb 29 def initialize(options) 30 super(nil, options) 31 @resolver_options = @options.resolver_options 32 resolv_options = @resolver_options.dup 33 timeouts = resolv_options.delete(:timeouts) || Resolver::RESOLVE_TIMEOUT 34 @_timeouts = Array(timeouts) 35 @timeouts = Hash.new { |tims, host| tims[host] = @_timeouts.dup } 36 resolv_options.delete(:cache) 37 @connections = [] 38 @queries = [] 39 @ips = [] 40 @pipe_mutex = Thread::Mutex.new 41 @state = :idle 42 end
Public Instance methods
<<(connection)
[show source]
# File lib/httpx/resolver/system.rb 90 def <<(connection) 91 @connections << connection 92 resolve 93 end
call()
[show source]
# File lib/httpx/resolver/system.rb 66 def call 67 case @state 68 when :open 69 consume 70 end 71 nil 72 end
close()
[show source]
# File lib/httpx/resolver/system.rb 54 def close 55 transition(:closed) 56 end
closed?()
[show source]
# File lib/httpx/resolver/system.rb 58 def closed? 59 @state == :closed 60 end
handle_socket_timeout(interval)
[show source]
# File lib/httpx/resolver/system.rb 95 def handle_socket_timeout(interval) 96 error = HTTPX::ResolveTimeoutError.new(interval, "timed out while waiting on select") 97 error.set_backtrace(caller) 98 on_error(error) 99 end
interests()
[show source]
# File lib/httpx/resolver/system.rb 74 def interests 75 return if @queries.empty? 76 77 :r 78 end
resolvers()
[show source]
# File lib/httpx/resolver/system.rb 44 def resolvers 45 return enum_for(__method__) unless block_given? 46 47 yield self 48 end
timeout()
[show source]
# File lib/httpx/resolver/system.rb 80 def timeout 81 return unless @queries.empty? 82 83 _, connection = @queries.first 84 85 return unless connection 86 87 @timeouts[connection.origin.host].first 88 end