class HTTPX::Resolver::System

  1. lib/httpx/resolver/system.rb
Superclass: Resolver

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

multi?()
[show source]
   # File lib/httpx/resolver/system.rb
18 def multi?
19   false
20 end
new(options)
[show source]
   # File lib/httpx/resolver/system.rb
25 def initialize(options)
26   super(nil, options)
27   @resolver_options = @options.resolver_options
28   resolv_options = @resolver_options.dup
29   timeouts = resolv_options.delete(:timeouts) || Resolver::RESOLVE_TIMEOUT
30   @_timeouts = Array(timeouts)
31   @timeouts = Hash.new { |tims, host| tims[host] = @_timeouts.dup }
32   resolv_options.delete(:cache)
33   @connections = []
34   @queries = []
35   @ips = []
36   @pipe_mutex = Thread::Mutex.new
37   @state = :idle
38 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
early_resolve(connection, **)
[show source]
   # File lib/httpx/resolver/system.rb
95 def early_resolve(connection, **)
96   self << connection
97   true
98 end
empty?()
[show source]
   # File lib/httpx/resolver/system.rb
50 def empty?
51   true
52 end
handle_socket_timeout(interval)
[show source]
    # File lib/httpx/resolver/system.rb
100 def handle_socket_timeout(interval)
101   error = HTTPX::ResolveTimeoutError.new(interval, "timed out while waiting on select")
102   error.set_backtrace(caller)
103   on_error(error)
104 end
interests()
[show source]
   # File lib/httpx/resolver/system.rb
74 def interests
75   return if @queries.empty?
76 
77   :r
78 end
multi()
[show source]
   # File lib/httpx/resolver/system.rb
46 def multi
47   self
48 end
resolvers()
[show source]
   # File lib/httpx/resolver/system.rb
40 def resolvers
41   return enum_for(__method__) unless block_given?
42 
43   yield self
44 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.peer.host].first
88 end
to_io()
[show source]
   # File lib/httpx/resolver/system.rb
62 def to_io
63   @pipe_read.to_io
64 end