mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
resolvers All kinds of errors happening during the select loop, will be handled as abrupt select loop errors, and terminate all connections; this also includes timmeout errors. This is not ideal, for some reasons: connection timeout errors happening on the loop close all connections, although it may be only triggered for one (or a subset of) connection for which the timeout should trigger; second, errors on the DS channel propagate errors to connections indirectly (the emission mentioned above), wrongly (connections for different hostnames not yet queried, will also fail with timeout), and won't clean the resolver state (so subsequent queries will be done for the same hostname which failed in the first place). This fix is a first step to solving this problem. It does not totally address the first, but i'll fix dealing with errors from the second use-case.
60 lines
1.3 KiB
Plaintext
60 lines
1.3 KiB
Plaintext
module HTTPX
|
|
module Resolver
|
|
class Native < Resolver
|
|
extend Forwardable
|
|
include _ToIO
|
|
|
|
DEFAULTS: Hash[Symbol, untyped]
|
|
DNS_PORT: Integer
|
|
|
|
@family: ip_family
|
|
@options: Options
|
|
@ns_index: Integer
|
|
@nameserver: String
|
|
@_timeouts: Array[Numeric]
|
|
@timeouts: Hash[String, Array[Numeric]]
|
|
@connections: Array[Connection]
|
|
@read_buffer: String
|
|
@write_buffer: Buffer
|
|
|
|
attr_reader state: Symbol
|
|
|
|
def call: () -> void
|
|
|
|
def interests: () -> (:r | :w | nil)
|
|
|
|
def <<: (Connection) -> void
|
|
|
|
def timeout: () -> Numeric?
|
|
|
|
def raise_timeout_error: (Numeric interval) -> void
|
|
|
|
private
|
|
|
|
def initialize: (ip_family family, options options) -> void
|
|
|
|
def calculate_interests: () -> (:r | :w | nil)
|
|
|
|
def consume: () -> void
|
|
|
|
def do_retry: (?Numeric loop_time) -> void
|
|
|
|
def dread: (Integer) -> void
|
|
| () -> void
|
|
|
|
def dwrite: () -> void
|
|
|
|
def parse: (String) -> void
|
|
|
|
def resolve: (?Connection connection, ?String hostname) -> void
|
|
|
|
def generate_candidates: (String) -> Array[String]
|
|
|
|
def build_socket: () -> void
|
|
|
|
def transition: (Symbol nextstate) -> void
|
|
|
|
def handle_error: (NativeResolveError | StandardError) -> void
|
|
end
|
|
end
|
|
end |