httpx/sig/connection.rbs
HoneyryderChuck 6c911768fe fixing selector timeout errors closing all connections and ignoring
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.
2022-06-22 02:09:26 +03:00

107 lines
2.3 KiB
Plaintext

module HTTPX
class Connection
interface _Parser
def on: (Symbol) { (*untyped) -> void } -> void
def empty?: () -> bool
# def exhausted?: () -> bool
def close: () -> void
def consume: () -> void
def <<: (string) -> void
# def send: (Request) -> void
# def ping: () -> void
# def timeout: () -> (Integer | Float)
end
extend Forwardable
include Loggable
include Callbacks
include HTTPX::Registry[String, Class]
BUFFER_SIZE: Integer
attr_reader origin: URI::Generic
attr_reader origins: Array[String]
attr_reader state: Symbol
attr_reader pending: Array[Request]
attr_reader options: Options
attr_writer timers: Timers
@origins: Array[URI::Generic]
@window_size: Integer
@read_buffer: Buffer
@write_buffer: Buffer
@inflight: Integer
@keep_alive_timeout: Numeric?
@total_timeout: Numeric?
def addresses: () -> Array[ipaddr]?
def addresses=: (Array[ipaddr]) -> void
def match?: (URI::Generic, options) -> bool
def mergeable?: (Connection) -> bool
def coalescable?: (Connection) -> bool
def create_idle: (?Hash[Symbol, untyped] options) -> Connection
def merge: (Connection) -> void
def purge_pending: () { (Request) -> void } -> void
def match_altsvcs?: (URI::Generic uri) -> bool
def connecting?: () -> bool
def inflight?: () -> boolish
def interests: () -> io_interests?
def to_io: () -> IO
def call: () -> void
def close: () -> void
def reset: () -> void
def send: (Request) -> void
def timeout: () -> Numeric?
def deactivate: () -> void
def raise_timeout_error: (Numeric interval) -> void
private
def initialize: (String, URI::Generic, options) -> untyped
def connect: () -> void
def exhausted?: () -> boolish
def consume: () -> void
def send_pending: () -> void
def parser: () -> _Parser
def send_request_to_parser: (Request request) -> void
def build_parser: () -> _Parser
| (String) -> _Parser
def set_parser_callbacks: (_Parser) -> void
def transition: (Symbol) -> void
def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
def handle_error: (StandardError) -> void
def purge_after_closed: () -> void
end
end