httpx/sig/pool.rbs
HoneyryderChuck 2940323412 implemented happy eyeballs v2 (rfc8305) for native and https resolver
Two resolver are kept (IPv6/IPv4) along in the pool, to which all
names are sent to and read from in the same pool. IPv4 resolves are
subject to a 50ms delay (as per rfc) before they're used for connecting.
IPv6 addresses have preference, in that if they arrive before the delay,
they are immediately used. If they arrive after the delay, they do not
interrupt the connection, but they'll be the next-in-line in case
connection handshake fails.

Two resolvers are kept, but the inherent Connection will be shared,
thereby sending name resolving requests to the same HTTP/2 connection in
bulk. The resolution delay logic from above also applies.

Currently handles resolving via `resolv` lib. This happens synchronously
though, so we're not there yet.
2022-01-16 22:54:56 +02:00

50 lines
1.3 KiB
Plaintext

module HTTPX
class Pool
type resolver_manager = Resolver::Multi | Resolver::System
@resolvers: Hash[Class, resolver_manager]
@timers: Timers
@selector: Selector
@connections: Array[Connection]
@connected_connections: Integer
def empty?: () -> void
def next_tick: () -> void
def close: (?Array[Connection] connections) -> void
def init_connection: (Connection connection, Options options) -> void
def find_connection: (URI::Generic uri, Options options) -> Connection?
def deactivate: (*Array[Connection]) -> void
private
def initialize: () -> untyped
def resolve_connection: (Connection) -> void
def on_resolver_connection: (Connection) -> void
def on_resolver_error: (Connection, StandardError) -> void
def on_resolver_close: (Resolver::Resolver) -> void
def register_connection: (Connection) -> void
def unregister_connection: (Connection) -> void
def select_connection: (Resolver::Resolver | Connection connection) -> void
def deselect_connection: (Resolver::Resolver | Connection connection) -> void
def coalesce_connections: (Connection coalescable, Connection coalescing) -> void
def next_timeout: () -> (Integer | Float | nil)
def find_resolver_for: (Connection) { (Resolver::Resolver resolver) -> void } -> resolver_manager
end
end